summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary, ↵Antoine Pitrou2012-03-011-0/+60
| | | | | | | WeakValueDictionary) to return a better approximation when some objects are dead or dying. Moreover, the implementation is now O(1) rather than O(n). Thanks to Yury Selivanov for reporting.
* NOTE: only ported the test for new-style classes.Antoine Pitrou2010-03-311-0/+12
| | | | | | | | | | | | Merged revisions 79535 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79535 | antoine.pitrou | 2010-03-31 23:32:15 +0200 (mer., 31 mars 2010) | 5 lines Issue #8268: Old-style classes (not just instances) now support weak references. ........
* use assert[Not]In where appropriateEzio Melotti2010-01-231-9/+6
|
* use assert[Not]In where appropriateBenjamin Peterson2010-01-191-13/+13
| | | | A patch from Dave Malcolm.
* Issue #7105: Make WeakKeyDictionary and WeakValueDictionary robust againstAntoine Pitrou2010-01-081-0/+87
| | | | the destruction of weakref'ed objects while iterating.
* fix __bytes__ handling here in py3xBenjamin Peterson2009-11-191-0/+11
| | | | | | | | | | | Merged revisions 76395 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76395 | benjamin.peterson | 2009-11-18 21:00:02 -0600 (Wed, 18 Nov 2009) | 1 line #5037 proxy __unicode__ correctly ........