Merged
Conversation
Most information copied from Github issue #11766
9 tasks
Contributor
Author
|
A diff of the python standard library implementation vs the replacement implementation: |
lukaszgo1
reviewed
Jul 5, 2021
michaelDCurran
requested changes
Jul 5, 2021
Member
michaelDCurran
left a comment
There was a problem hiding this comment.
Would it not be better for maintainability that replacement__new__ is simply:
if value not in cls.__members__.values():
raise ValueError(f"{value} is not a supported value of {cls}")
return old__new__(value)
Though obviously what you wrote will be useful for a pr against cPython.
But other than the other corrections I and @lukaszgo1 have mentioned, I'd be happy to approve with the code you have here.
Co-authored-by: Michael Curran <mick@nvaccess.org>
Co-authored-by: Michael Curran <mick@nvaccess.org>
Contributor
Author
I'm trying to maintain compatibility with the built-in enum behavior. There are a number of other values that it accepts for various reasons. Using the suggestion would mean that only values for the enum are accepted. |
michaelDCurran
approved these changes
Jul 9, 2021
9 tasks
seanbudd
pushed a commit
that referenced
this pull request
Sep 13, 2021
…rent than the one used for building NVDA (#12835) Fixes regression from #12617. Discovered when working on #12753 as that PR required executing unit tests under various versions of Windows Summary of the issue: It is sometimes useful to execute unit tests under various versions of Windows where it is impractical, or even impossible to have full build environment for NVDA. With current master some tests are failing because when importing COM interfaces comtypes complains about them being created on different version of Windows. Before PR #12617 this worked by chance since our monkey patches for compypes were applied when importing core and it just so happened that core was imported before any COM interface was. Description of how this pull request fixes the issue: Since we have monkey patch which stops comtypes from complaining about typelib being different than COM interface it has been applied to comtypes before tests starts. To avoid copying code of this monkey patch it was necessary to refactor our monkey patches to make each of them into a separate function - that allows us to apply them selectively rather than just all of them during import. Testing strategy: Ensured that unit tests pass under a never version of Windows than the one under which virtual environment for NVDA has been created Ensured that comtypes monkey patches are properly applied for NVDA in particular that core.CallCancelled is raised when appropriate.
codeofdusk
added a commit
to codeofdusk/nvda
that referenced
this pull request
Sep 25, 2023
… appears to have been fixed upstream (I can still reproduce it under 3.7 but not under 3.11).
codeofdusk
added a commit
to codeofdusk/nvda
that referenced
this pull request
Sep 26, 2023
…sent in Python 3.11+. Partially reverts nvaccess#12617.
5 tasks
seanbudd
pushed a commit
that referenced
this pull request
Sep 26, 2023
…sent in Python 3.11+. (#15531) Partially reverts #12617. Summary of the issue: #12617 added a patched __new__ to work around a GC cycle in Python 3.7. However, on Python 3.11 and 3.12, this is no longer present. Description of how this pull request fixes the issue: Remove the patched method. Testing strategy: Tested that On Python 3.7, the cyclic ref is present when the patched __new__ is removed. On Python 3.11, no unreachable object error is reported in IA2 documents. On Python 3.12, no unreachable object error is reported in IA2 documents.
seanbudd
pushed a commit
that referenced
this pull request
Sep 27, 2023
…sent in Python 3.11+. (#15531) Partially reverts #12617. Summary of the issue: #12617 added a patched __new__ to work around a GC cycle in Python 3.7. However, on Python 3.11 and 3.12, this is no longer present. Description of how this pull request fixes the issue: Remove the patched method. Testing strategy: Tested that On Python 3.7, the cyclic ref is present when the patched __new__ is removed. On Python 3.11, no unreachable object error is reported in IA2 documents. On Python 3.12, no unreachable object error is reported in IA2 documents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Blocking PR #12500
Summary of the issue:
When creating DescriptionFor enum values, a "ValueError" can be raised.
There is a bug in the Python standard library for enum, causing a cyclic reference.
The exception is referenced by the frame.
The frame is referenced by the traceback.
The traceback is referenced by the exception.
This is detected by NVDA as an unreachable object, logging an error.
Description of how this pull request fixes the issue:
This patches the
enum.Enum.__new__method to no longer reference the exception from the frame.Testing strategy:
Merged with #12500, ran with sample, ensured no unreachable object log error.
Unit testing this would be difficult, we'd have to install the NVDA
garbageHandler, this would cause side affects for all tests.These errors are reported to the log of system tests already.
In future we plan for system tests to fail if there are ANY errors in the log, however right now there are several
expected errors in the log on appveyor.
These first need to be resolved.
Additionally, we are in the process of resolving a tricky intermittent failure for system tests.
Once the intermittent failure is resolved we can look to make the tests more strict.
Known issues with pull request:
None
Change log entries:
None
Code Review Checklist: