Author: Philip Jenvey <[email protected]>
Branch: stdlib-2.7.11
Changeset: r83284:d2bb4879ed49
Date: 2016-03-22 18:51 -0700
http://bitbucket.org/pypy/pypy/changeset/d2bb4879ed49/
Log: unwrap_spec doesn't work with GetSetProperty funcs, fix
diff --git a/pypy/module/pyexpat/interp_pyexpat.py
b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -623,9 +623,8 @@
def get_namespace_prefixes(self, space):
return space.wrap(self.ns_prefixes)
- @unwrap_spec(value=int)
- def set_namespace_prefixes(self, space, value):
- self.ns_prefixes = bool(value)
+ def set_namespace_prefixes(self, space, w_value):
+ self.ns_prefixes = space.bool_w(w_value)
XML_SetReturnNSTriplet(self.itself, self.ns_prefixes)
# Parse methods
diff --git a/pypy/module/pyexpat/test/test_parser.py
b/pypy/module/pyexpat/test/test_parser.py
--- a/pypy/module/pyexpat/test/test_parser.py
+++ b/pypy/module/pyexpat/test/test_parser.py
@@ -23,11 +23,15 @@
def test_attributes(self):
import pyexpat
p = pyexpat.ParserCreate()
- assert p.buffer_text is False
- assert p.namespace_prefixes is False
- assert p.returns_unicode is True
- assert p.ordered_attributes is False
- assert p.specified_attributes is False
+ def test_setget(p, attr, default=False):
+ assert getattr(p, attr) is default
+ for x in 0, 1, 2, 0:
+ setattr(p, attr, x)
+ assert getattr(p, attr) is bool(x), attr
+ for attr in ('buffer_text', 'namespace_prefixes', 'ordered_attributes',
+ 'specified_attributes'):
+ test_setget(p, attr)
+ test_setget(p, 'returns_unicode', True)
def test_version(self):
import pyexpat
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit