Justin Peel avatar Justin Peel committed 2028a5a

Backed out changeset 70f26346fd5b

Comments (0)

Files changed (1)

pypy/module/pyexpat/interp_pyexpat.py

         if id < 0:
             id = global_storage.next_id
             global_storage.next_id += 1
-        global_storage.storage[id] = obj
+        global_storage.storage[id] = weakref.ref(obj)
         return id
 
     @staticmethod
 class CallbackData(Wrappable):
     def __init__(self, space, parser):
         self.space = space
-        self.parser = weakref.ref(parser)
+        self.parser = parser
 
 SETTERS = {}
 for index, (name, params) in enumerate(HANDLERS.items()):
     src = py.code.Source("""
     def %(name)s_callback(%(first_arg)s, %(args)s):
         id = rffi.cast(lltype.Signed, %(ll_id)s)
-        userdata = global_storage.get_object(id)
+        userdata = global_storage.get_object(id)()
         space = userdata.space
-        parser = userdata.parser()
+        parser = userdata.parser
 
         handler = parser.handlers[%(index)s]
         if not handler:
 # and it's not modifiable via user code anyway
 def UnknownEncodingHandlerData_callback(ll_userdata, name, info):
     id = rffi.cast(lltype.Signed, ll_userdata)
-    userdata = global_storage.get_object(id)
+    userdata = global_storage.get_object(id)()
     space = userdata.space
-    parser = userdata.parser()
+    parser = userdata.parser
 
     name = rffi.charp2str(name)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.