summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-99051: remove duplicated test from `test_weakref` (GH-99052)Miss Islington (bot)2022-11-061-35/+6
| | | | | (cherry picked from commit 8463cb55dabb78571e32d8c8c7de8679ab421c2c) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.10] gh-79512: Fixed names and __module__ value of weakref classes ↵Serhiy Storchaka2022-06-211-0/+11
| | | | | | | | | | (GH-93719) (GH-94071) Classes ReferenceType, ProxyType and CallableProxyType have now correct atrtributes __module__, __name__ and __qualname__. It makes them (types, not instances) pickleable. (cherry picked from commit 8352e322e87ba39c71e578b65ad8ae156ca3e0c7) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] Fix typos in the Lib directory (GH-28775) (GH-28804)Christian Clauss2021-10-071-1/+1
| | | | | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>. (cherry picked from commit 745c9d9dfc1ad6fdfdf1d07420c6273ff67fa5be) Co-authored-by: Christian Clauss <cclauss@me.com>
* [3.10] bpo-25130: Add calls of gc.collect() in tests to support PyPy ↵Serhiy Storchaka2021-09-081-1/+22
| | | | | | | (GH-28005) (GH-28027) (cherry picked from commit 2a8127cafe1d196f858a3ecabf5f1df3eebf9a12) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44720: Don't crash when calling weakref.proxy(not_an_iterator).__next__ ↵Miss Islington (bot)2021-07-241-0/+30
| | | | | | | (GH-27316) (GH-27324) (cherry picked from commit 5370f0a82aaa4ba617070d5c71d2b18236096ac0) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* bpo-44523: Remove the pass-through for hash() in weakref proxy objects ↵Miss Islington (bot)2021-06-291-4/+10
| | | | | | | (GH-26950) (cherry picked from commit e2fea101fd5517f33371b04432842b971021c3bf) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy ↵Pablo Galindo2020-05-051-0/+20
| | | | objects (GH-19946)
* bpo-36144: Add union operators to WeakValueDictionary584 (#19127)Curtis Bucher2020-03-251-0/+37
|
* bpo-36144: Add union operators to WeakKeyDictionary (#19106)Curtis Bucher2020-03-231-0/+37
|
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-031-1/+0
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-38395: Fix ownership in weakref.proxy methods (GH-16632)Pablo Galindo2019-10-081-0/+20
| | | | | | | | | | | | | The implementation of weakref.proxy's methods call back into the Python API using a borrowed references of the weakly referenced object (acquired via PyWeakref_GET_OBJECT). This API call may delete the last reference to the object (either directly or via GC), leaving a dangling pointer, which can be subsequently dereferenced. To fix this, claim a temporary ownership of the referenced object when calling the appropriate method. Some functions because at the moment they do not need to access the borrowed referent, but to protect against future changes to these functions, ownership need to be fixed in all potentially affected methods.
* bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)Victor Stinner2019-09-091-0/+5
| | | | | weakref.WeakValueDictionary defines a local remove() function used as callback for weak references. This function was created with a closure. Modify the implementation to avoid the closure.
* bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)Serhiy Storchaka2019-08-081-1/+8
| | | | They now return NotImplemented for unsupported type of the other operand.
* [3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)Serhiy Storchaka2019-06-051-14/+4
| | | Turn deprecation warnings added in 3.8 into TypeError.
* bpo-36669: add matmul support to weakref.proxy (GH-12932)Mark Dickinson2019-04-261-0/+15
|
* bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)Serhiy Storchaka2019-04-011-0/+29
| | | | | | | | | | | | | | | | | | | | | | Deprecated passing the following arguments as keyword arguments: - "func" in functools.partialmethod(), weakref.finalize(), profile.Profile.runcall(), cProfile.Profile.runcall(), bdb.Bdb.runcall(), trace.Trace.runfunc() and curses.wrapper(). - "function" in unittest.addModuleCleanup() and unittest.TestCase.addCleanup(). - "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor and concurrent.futures.ProcessPoolExecutor. - "callback" in contextlib.ExitStack.callback(), contextlib.AsyncExitStack.callback() and contextlib.AsyncExitStack.push_async_callback(). - "c" and "typeid" in the create() method of multiprocessing.managers.Server and multiprocessing.managers.SharedMemoryServer. - "obj" in weakref.finalize(). Also allowed to pass arbitrary keyword arguments (even "self" and "func") if the above arguments are passed as positional argument.
* bpo-35615: Fix crashes when copying a Weak{Key,Value}Dictionary. (GH-11384)Fish2019-02-071-0/+82
| | | | | | | | | | Protect dict iterations by wrapping them with _IterationGuard in the following methods: - WeakValueDictionary.copy() - WeakValueDictionary.__deepcopy__() - WeakKeyDictionary.copy() - WeakKeyDictionary.__deepcopy__()
* bpo-32746: Fix multiple typos (GH-5144)Leo Arias2018-02-041-1/+1
| | | Fix typos found by codespell in docs, docstrings, and comments.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-1/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Issue #28427: old keys should not remove new values fromAntoine Pitrou2016-12-271-0/+12
|\ | | | | | | WeakValueDictionary when collecting from another thread.
| * Issue #28427: old keys should not remove new values fromAntoine Pitrou2016-12-271-0/+12
| | | | | | | | WeakValueDictionary when collecting from another thread.
* | Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and ↵Antoine Pitrou2016-12-191-0/+41
|\ \ | |/ | | | | | | | | | | | | WeakValueDictionary.pop() when a GC collection happens in another thread. Original patch and report by Armin Rigo.
| * Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and ↵Antoine Pitrou2016-12-191-0/+41
| | | | | | | | | | | | | | | | WeakValueDictionary.pop() when a GC collection happens in another thread. Original patch and report by Armin Rigo.
* | merge 3.5 (#26617)Benjamin Peterson2016-10-041-0/+8
|\ \ | |/
| * ensure gc tracking is off when invoking weakref callbacks (closes #26617)Benjamin Peterson2016-10-041-0/+8
| |
* | Implement compact dictVictor Stinner2016-09-081-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Issue #27350: `dict` implementation is changed like PyPy. It is more compact and preserves insertion order. _PyDict_Dummy() function has been removed. Disable test_gdb: python-gdb.py is not updated yet to the new structure of compact dictionaries (issue #28023). Patch written by INADA Naoki.
* | Correct a comment in the test referencing the wrong issue number (issue3100Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-071-1/+1
|/ | | | is correct, not 3110).
* Issue #19527: Fixed tests with defined COUNT_ALLOCS.Serhiy Storchaka2016-07-031-0/+1
|
* Issue #17765: weakref.ref() no longer silently ignores keyword arguments.Serhiy Storchaka2016-05-071-0/+4
| | | | Patch by Georg Brandl.
* Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-021-1/+1
|\
| * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | Issue #22958: Constructor and update method of weakref.WeakValueDictionarySerhiy Storchaka2015-09-291-0/+25
|\ \ | |/ | | | | now accept the self and the dict keyword arguments.
| * Issue #22958: Constructor and update method of weakref.WeakValueDictionarySerhiy Storchaka2015-09-291-0/+25
| | | | | | | | now accept the self and the dict keyword arguments.
* | Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-1/+2
| | | | | | | | Patch by Christie Wilson.
* | Closes #21173: Fix len() on a WeakKeyDictionary when .clear() was called ↵Antoine Pitrou2014-10-051-0/+36
|\ \ | |/ | | | | with an iterator alive.
| * Closes #21173: Fix len() on a WeakKeyDictionary when .clear() was called ↵Antoine Pitrou2014-10-051-0/+36
| | | | | | | | with an iterator alive.
* | merge 3.4 (#22267)Benjamin Peterson2014-08-241-0/+2
|\ \ | |/
| * fix some test_weakref tests to not rely on ref-counting (closes #22267)Benjamin Peterson2014-08-241-0/+2
| |
* | Issue #22116: C functions and methods (of the 'builtin_function_or_method' ↵Antoine Pitrou2014-08-061-0/+12
| | | | | | | | type) can now be weakref'ed. Patch by Wei Wu.
* | Issue #22031: Reprs now always use hexadecimal format with the "0x" prefixSerhiy Storchaka2014-07-221-0/+8
|/ | | | when contain an id in form " at 0x...".
* Issue #19607: Use specific asserts in weakref tests.Serhiy Storchaka2013-11-171-65/+62
|\
| * Issue #19607: Use specific asserts in weakref tests.Serhiy Storchaka2013-11-171-65/+62
| |
* | Issue #15528: Add weakref.finalize to support finalization usingRichard Oudkerk2013-05-051-1/+151
| | | | | | | | | | | | | | | | | | weakref callbacks. This is 2e446e87ac5b except that collections/__init__.py has been modified to import proxy from _weakref instead of weakref. This eliminates an import cycle which seems to cause a problem on Unix but not Windows.
* | Backout 2e446e87ac5b; it breaks the unix buildbots.Richard Oudkerk2013-05-051-151/+1
| |
* | Issue #15528: Add weakref.finalize to support finalization usingRichard Oudkerk2013-05-051-1/+151
| | | | | | | | weakref callbacks.
* | Issue #17643: Add __callback__ attribute to weakref.ref.Mark Dickinson2013-04-131-0/+24
| |
* | Issue #16602: When a weakref's target was part of a long deallocation chain, ↵Antoine Pitrou2012-12-081-0/+21
|\ \ | |/ | | | | | | | | the object could remain reachable through its weakref even though its refcount had dropped to zero. Thanks to Eugene Toder for diagnosing and reporting the issue.
| * Issue #16602: When a weakref's target was part of a long deallocation chain, ↵Antoine Pitrou2012-12-081-0/+21
| | | | | | | | | | | | the object could remain reachable through its weakref even though its refcount had dropped to zero. Thanks to Eugene Toder for diagnosing and reporting the issue.
* | Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak ↵Antoine Pitrou2012-11-171-0/+140
|/ | | | references to bound methods.
* Issue #16453: Fix equality testing of dead weakref objects.Antoine Pitrou2012-11-111-21/+84
| | | | Also add tests for ordering and hashing.