Author: Matti Picus <[email protected]>
Branch: vendor/stdlib-2.7.16
Changeset: r96637:819d32f3f951
Date: 2019-05-20 07:51 +0300
http://bitbucket.org/pypy/pypy/changeset/819d32f3f951/
Log: implement weakref._remove_dead_weakref, change pip version in
ensurepip
diff --git a/lib-python/2.7/ensurepip/__init__.py
b/lib-python/2.7/ensurepip/__init__.py
--- a/lib-python/2.7/ensurepip/__init__.py
+++ b/lib-python/2.7/ensurepip/__init__.py
@@ -14,7 +14,7 @@
_SETUPTOOLS_VERSION = "40.6.2"
-_PIP_VERSION = "18.1"
+_PIP_VERSION = "19.1.1"
_PROJECTS = [
("setuptools", _SETUPTOOLS_VERSION),
diff --git a/pypy/module/_weakref/interp__weakref.py
b/pypy/module/_weakref/interp__weakref.py
--- a/pypy/module/_weakref/interp__weakref.py
+++ b/pypy/module/_weakref/interp__weakref.py
@@ -313,8 +313,19 @@
if not space.isinstance_w(w_dict, space.w_dict):
raise oefmt(space.w_TypeError,
'_remove_dead_weakref() argument 1 must be dict, not %R', w_dict)
- raise oefmt(space.w_NotImplementedError, "Not implemented yet")
- # CPython uses a PyDict_DelItemIf(dct, key, is_dead_weakref)
+ # The call is supposed to be "atomic"
+ try:
+ w_value = space.getitem(w_dict, w_key)
+ except KeyError:
+ return
+ if w_value is None:
+ return
+ if not space.isinstance_w(w_value, W_WeakrefBase):
+ raise oefmt(space.w_TypeError, "not a weakref")
+ w_ref = w_value.dereference()
+ if w_ref is None or space.isinstance_w(w_ref, space.w_None):
+ return
+ space.delitem(w_dict, w_key)
#_________________________________________________________________
# Proxy
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit