Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
Closed as not planned
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The _decimal module was recently fixed in #123243. I also found that _pylong leaks globals due to the creation of a global context to use as a local context:
_unbounded_dec_context=decimal.getcontext().copy() _unbounded_dec_context.prec=decimal.MAX_PREC_unbounded_dec_context.Emax=decimal.MAX_EMAX_unbounded_dec_context.Emin=decimal.MIN_EMIN_unbounded_dec_context.traps[decimal.Inexact] =1# sanity checkThis context is used as with decimal.localcontext(_unbounded_dec_context). On the other hand decimal.getcontext().copy() returns a copy of the decimal context for the current thread (or set it to decimal.DefaultContext if none exists). Instead of setting it like that, I suggest that we construct a decimal.Context() object directly in _pylong instead of possibly polluting the decimal module (whether it's the C or the python implementation).
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error