1. Pypy
  2. Untitled project
  3. pypy

Commits

Philip Jenvey  committed 38799d7 Merge

merge default

  • Participants
  • Parent commits 5c54a69, 65f3a63
  • Branches py3k

Comments (0)

Files changed (12)

File pypy/interpreter/baseobjspace.py

View file
  • Ignore whitespace
             )
         return fd
 
-    def warn(self, msg, w_warningcls):
-        self.appexec([self.wrap(msg), w_warningcls], """(msg, warningcls):
+    def warn(self, w_msg, w_warningcls, stacklevel=2):
+        self.appexec([w_msg, w_warningcls, self.wrap(stacklevel)],
+                     """(msg, warningcls, stacklevel):
             import _warnings
-            _warnings.warn(msg, warningcls, stacklevel=2)
+            _warnings.warn(msg, warningcls, stacklevel=stacklevel)
         """)
 
 

File pypy/interpreter/pyopcode.py

  • Ignore whitespace
File contents unchanged.

File pypy/module/_io/interp_bufferedio.py

  • Ignore whitespace
File contents unchanged.

File pypy/module/cpyext/import_.py

View file
  • Ignore whitespace
 
 @cpython_api([CONST_STRING], PyObject)
 def PyImport_ImportModuleNoBlock(space, name):
-    space.warn('PyImport_ImportModuleNoBlock() is not non-blocking',
-               space.w_RuntimeWarning)
+    space.warn(
+        space.wrap('PyImport_ImportModuleNoBlock() is not non-blocking'),
+        space.w_RuntimeWarning)
     return PyImport_Import(space, space.wrap(rffi.charp2str(name)))
 
 @cpython_api([PyObject], PyObject)

File pypy/module/exceptions/interp_exceptions.py

View file
  • Ignore whitespace
         if self.w_message is None:
             raise OperationError(space.w_AttributeError,
                                  space.wrap("message was deleted"))
-        space.warn("BaseException.message has been deprecated as of Python 2.6",
-                   space.w_DeprecationWarning)
+        msg = "BaseException.message has been deprecated as of Python 2.6"
+        space.warn(space.wrap(msg), space.w_DeprecationWarning)
         return self.w_message
 
     def descr_message_set(self, space, w_new):

File pypy/module/imp/importing.py

View file
  • Ignore whitespace
                     "Parent module '%s' not loaded, "
                     "cannot perform relative import" % ctxt_package))
             else:
-                space.warn("Parent module '%s' not found "
-                           "while handling absolute import" % ctxt_package,
-                           space.w_RuntimeWarning)
+                msg = ("Parent module '%s' not found while handling absolute "
+                       "import" % ctxt_package)
+                space.warn(space.wrap(msg), space.w_RuntimeWarning)
 
         rel_modulename = ctxt_package[:dot_position]
         rel_level = rel_modulename.count('.') + 1
                 if modtype in (PY_SOURCE, PY_COMPILED):
                     return FindInfo(PKG_DIRECTORY, filepart, None)
                 else:
-                    msg = "Not importing directory " +\
-                            "'%s' missing __init__.py" % (filepart,)
-                    space.warn(msg, space.w_ImportWarning)
+                    msg = ("Not importing directory '%s' missing __init__.py" %
+                           (filepart,))
+                    space.warn(space.wrap(msg), space.w_ImportWarning)
             modtype, suffix, filemode = find_modtype(space, filepart)
             try:
                 if modtype in (PY_SOURCE, PY_COMPILED, C_EXTENSION):

File pypy/module/struct/formatiterator.py

View file
  • Ignore whitespace
         def _maybe_float(self, w_obj):
             space = self.space
             if space.is_true(space.isinstance(w_obj, space.w_float)):
-                space.warn("struct: integer argument expected, got float",
-                           space.w_DeprecationWarning)
+                msg = "struct: integer argument expected, got float"
             else:
-                space.warn("integer argument expected, got non-integer",
-                           space.w_DeprecationWarning)
+                msg = "integer argument expected, got non-integer"
+            space.warn(space.wrap(msg), space.w_DeprecationWarning)
             return space.int(w_obj)   # wrapped float -> wrapped int or long
 
     else:

File pypy/objspace/std/complexobject.py

  • Ignore whitespace
File contents unchanged.

File pypy/objspace/std/objecttype.py

View file
  • Ignore whitespace
         msg = "format_spec must be a string"
         raise OperationError(space.w_TypeError, space.wrap(msg))
     if space.len_w(w_format_spec) > 0:
-        space.warn(
-            ("object.__format__ with a non-empty format string is "
-                "deprecated"),
-            space.w_PendingDeprecationWarning
-        )
+        msg = "object.__format__ with a non-empty format string is deprecated"
+        space.warn(space.wrap(msg), space.w_PendingDeprecationWarning)
     return space.format(w_as_str, w_format_spec)
 
 def descr___subclasshook__(space, __args__):

File pypy/objspace/std/typeobject.py

View file
  • Ignore whitespace
             msg = "can't set attributes on type object '%s'"
             raise operationerrfmt(space.w_TypeError, msg, w_self.name)
         if name == "__del__" and name not in w_self.dict_w:
-            msg = "a __del__ method added to an existing type will not be called"
-            space.warn(msg, space.w_RuntimeWarning)
+            msg = ("a __del__ method added to an existing type will not be "
+                   "called")
+            space.warn(space.wrap(msg), space.w_RuntimeWarning)
         if space.config.objspace.std.withtypeversion:
             version_tag = w_self.version_tag()
             if version_tag is not None:

File pypy/objspace/std/unicodeobject.py

  • Ignore whitespace
File contents unchanged.

File rpython/rlib/rsocket.py

View file
  • Ignore whitespace
     def __del__(self):
         fd = self.fd
         if fd != _c.INVALID_SOCKET:
-            self.fd = _c.INVALID_SOCKET
-            _c.socketclose(fd)
+            try:
+                self._dealloc_warn()
+            finally:
+                self.fd = _c.INVALID_SOCKET
+                _c.socketclose(fd)
+
+    def _dealloc_warn(self):
+        """Called when implicitly closed via the deconstructor"""
+        pass
 
     if hasattr(_c, 'fcntl'):
         def _setblocking(self, block):