Author: Alexander Hesse <webmas...@aquanasoft.de> Branch: quiet-rpython Changeset: r60671:f169915b9457 Date: 2013-01-29 13:15 +0100 http://bitbucket.org/pypy/pypy/changeset/f169915b9457/
Log: hg merge default diff --git a/lib-python/conftest.py b/lib-python/conftest.py --- a/lib-python/conftest.py +++ b/lib-python/conftest.py @@ -61,7 +61,7 @@ usemodules = '', skip=None): self.basename = basename - self._usemodules = usemodules.split() + ['signal'] + self._usemodules = usemodules.split() + ['signal', 'rctime', 'itertools', '_socket'] self._compiler = compiler self.core = core self.skip = skip @@ -93,63 +93,57 @@ m.test_main() ''' % locals()) -if sys.platform == 'win32': - skip_win32 = "Not supported on Windows" - only_win32 = False -else: - skip_win32 = False - only_win32 = "Only on Windows" - testmap = [ RegrTest('test___all__.py', core=True), RegrTest('test___future__.py', core=True), - RegrTest('test__locale.py', skip=skip_win32), + RegrTest('test__locale.py', usemodules='_locale'), RegrTest('test_abc.py'), RegrTest('test_abstract_numbers.py'), - RegrTest('test_aepack.py', skip=True), + RegrTest('test_aepack.py'), RegrTest('test_aifc.py'), - RegrTest('test_argparse.py'), - RegrTest('test_al.py', skip=True), - RegrTest('test_ast.py', core=True), - RegrTest('test_anydbm.py'), - RegrTest('test_applesingle.py', skip=True), - RegrTest('test_array.py', core=True, usemodules='struct array'), + RegrTest('test_al.py'), + RegrTest('test_anydbm.py', usemodules='struct'), + RegrTest('test_applesingle.py'), + RegrTest('test_argparse.py', usemodules='binascii'), + RegrTest('test_array.py', core=True, usemodules='struct array binascii'), RegrTest('test_ascii_formatd.py'), - RegrTest('test_asynchat.py', usemodules='thread'), - RegrTest('test_asyncore.py'), + RegrTest('test_ast.py', core=True, usemodules='struct'), + RegrTest('test_asynchat.py', usemodules='select fcntl'), + RegrTest('test_asyncore.py', usemodules='select fcntl'), RegrTest('test_atexit.py', core=True), - RegrTest('test_audioop.py', skip=True), + RegrTest('test_audioop.py', skip="unsupported extension module"), RegrTest('test_augassign.py', core=True), - RegrTest('test_base64.py'), + RegrTest('test_base64.py', usemodules='struct'), RegrTest('test_bastion.py'), + RegrTest('test_bigaddrspace.py'), + RegrTest('test_bigmem.py'), RegrTest('test_binascii.py', usemodules='binascii'), - RegrTest('test_binhex.py'), - RegrTest('test_binop.py', core=True), RegrTest('test_bisect.py', core=True, usemodules='_bisect'), RegrTest('test_bool.py', core=True), - RegrTest('test_bsddb.py', skip="unsupported extension module"), - RegrTest('test_bsddb185.py', skip="unsupported extension module"), - RegrTest('test_bsddb3.py', skip="unsupported extension module"), + RegrTest('test_bsddb.py'), + RegrTest('test_bsddb185.py'), + RegrTest('test_bsddb3.py'), RegrTest('test_buffer.py'), RegrTest('test_bufio.py', core=True), - RegrTest('test_builtin.py', core=True), - RegrTest('test_bytes.py'), + RegrTest('test_builtin.py', core=True, usemodules='binascii'), + RegrTest('test_bytes.py', usemodules='struct binascii'), RegrTest('test_bz2.py', usemodules='bz2'), RegrTest('test_calendar.py'), RegrTest('test_call.py', core=True), RegrTest('test_capi.py', skip="not applicable"), - RegrTest('test_cd.py', skip=True), + RegrTest('test_cd.py'), RegrTest('test_cfgparser.py'), - RegrTest('test_cgi.py'), RegrTest('test_charmapcodec.py', core=True), - RegrTest('test_cl.py', skip=True), + RegrTest('test_cl.py'), RegrTest('test_class.py', core=True), RegrTest('test_cmath.py', core=True), RegrTest('test_cmd.py'), + RegrTest('test_cmd_line.py'), RegrTest('test_cmd_line_script.py'), + RegrTest('test_code.py', core=True), RegrTest('test_codeccallbacks.py', core=True), RegrTest('test_codecencodings_cn.py', usemodules='_multibytecodec'), RegrTest('test_codecencodings_hk.py', usemodules='_multibytecodec'), @@ -157,7 +151,6 @@ RegrTest('test_codecencodings_jp.py', usemodules='_multibytecodec'), RegrTest('test_codecencodings_kr.py', usemodules='_multibytecodec'), RegrTest('test_codecencodings_tw.py', usemodules='_multibytecodec'), - RegrTest('test_codecmaps_cn.py', usemodules='_multibytecodec'), RegrTest('test_codecmaps_hk.py', usemodules='_multibytecodec'), RegrTest('test_codecmaps_jp.py', usemodules='_multibytecodec'), @@ -165,6 +158,7 @@ RegrTest('test_codecmaps_tw.py', usemodules='_multibytecodec'), RegrTest('test_codecs.py', core=True, usemodules='_multibytecodec'), RegrTest('test_codeop.py', core=True), + RegrTest('test_coding.py', core=True), RegrTest('test_coercion.py', core=True), RegrTest('test_collections.py'), RegrTest('test_colorsys.py'), @@ -174,22 +168,24 @@ RegrTest('test_compileall.py'), RegrTest('test_compiler.py', core=False, skip="slowly deprecating compiler"), RegrTest('test_complex.py', core=True), - + RegrTest('test_complex_args.py'), RegrTest('test_contains.py', core=True), + RegrTest('test_contextlib.py', usemodules="thread"), RegrTest('test_cookie.py'), RegrTest('test_cookielib.py'), RegrTest('test_copy.py', core=True), RegrTest('test_copy_reg.py', core=True), RegrTest('test_cpickle.py', core=True), - RegrTest('test_cprofile.py'), - RegrTest('test_crypt.py', usemodules='crypt', skip=skip_win32), + RegrTest('test_cprofile.py'), + RegrTest('test_crypt.py', usemodules='crypt'), RegrTest('test_csv.py', usemodules='_csv'), - - RegrTest('test_curses.py', skip="unsupported extension module"), + RegrTest('test_ctypes.py', usemodules="_rawffi thread"), + RegrTest('test_curses.py'), RegrTest('test_datetime.py'), RegrTest('test_dbm.py'), RegrTest('test_decimal.py'), RegrTest('test_decorators.py', core=True), + RegrTest('test_defaultdict.py', usemodules='_collections'), RegrTest('test_deque.py', core=True, usemodules='_collections'), RegrTest('test_descr.py', core=True, usemodules='_weakref'), RegrTest('test_descrtut.py', core=True), @@ -200,7 +196,7 @@ RegrTest('test_dircache.py', core=True), RegrTest('test_dis.py'), RegrTest('test_distutils.py', skip=True), - RegrTest('test_dl.py', skip=True), + RegrTest('test_dl.py'), RegrTest('test_doctest.py', usemodules="thread"), RegrTest('test_doctest2.py'), RegrTest('test_docxmlrpc.py'), @@ -208,20 +204,22 @@ RegrTest('test_dummy_thread.py', core=True), RegrTest('test_dummy_threading.py', core=True), RegrTest('test_email.py'), - RegrTest('test_email_codecs.py'), + RegrTest('test_email_renamed.py'), RegrTest('test_enumerate.py', core=True), RegrTest('test_eof.py', core=True), RegrTest('test_epoll.py'), RegrTest('test_errno.py', usemodules="errno"), + RegrTest('test_exception_variations.py'), RegrTest('test_exceptions.py', core=True), RegrTest('test_extcall.py', core=True), - RegrTest('test_fcntl.py', usemodules='fcntl', skip=skip_win32), + RegrTest('test_fcntl.py', usemodules='fcntl'), RegrTest('test_file.py', usemodules="posix", core=True), RegrTest('test_file2k.py', usemodules="posix", core=True), RegrTest('test_filecmp.py', core=True), RegrTest('test_fileinput.py', core=True), RegrTest('test_fileio.py'), + RegrTest('test_float.py', core=True), RegrTest('test_fnmatch.py', core=True), RegrTest('test_fork1.py', usemodules="thread"), RegrTest('test_format.py', core=True), @@ -230,6 +228,7 @@ RegrTest('test_frozen.py', skip="unsupported extension module"), RegrTest('test_ftplib.py'), RegrTest('test_funcattrs.py', core=True), + RegrTest('test_functools.py'), RegrTest('test_future.py', core=True), RegrTest('test_future1.py', core=True), RegrTest('test_future2.py', core=True), @@ -239,41 +238,37 @@ RegrTest('test_future_builtins.py'), RegrTest('test_gc.py', usemodules='_weakref', skip="implementation detail"), RegrTest('test_gdb.py', skip="not applicable"), - RegrTest('test_gdbm.py', skip="unsupported extension module"), + RegrTest('test_gdbm.py'), RegrTest('test_generators.py', core=True, usemodules='thread _weakref'), RegrTest('test_genericpath.py'), RegrTest('test_genexps.py', core=True, usemodules='_weakref'), - RegrTest('test_getargs.py', skip="unsupported extension module"), - RegrTest('test_getargs2.py', skip="unsupported extension module"), - + RegrTest('test_getargs.py'), + RegrTest('test_getargs2.py', usemodules='binascii', skip=True), RegrTest('test_getopt.py', core=True), RegrTest('test_gettext.py'), - - RegrTest('test_gl.py', skip=True), + RegrTest('test_gl.py'), RegrTest('test_glob.py', core=True), RegrTest('test_global.py', core=True), RegrTest('test_grammar.py', core=True), - RegrTest('test_grp.py', skip=skip_win32), - - RegrTest('test_gzip.py'), + RegrTest('test_grp.py'), + RegrTest('test_gzip.py', usemodules='zlib'), RegrTest('test_hash.py', core=True), RegrTest('test_hashlib.py', core=True), - RegrTest('test_heapq.py', core=True), RegrTest('test_hmac.py'), RegrTest('test_hotshot.py', skip="unsupported extension module"), - RegrTest('test_htmllib.py'), RegrTest('test_htmlparser.py'), RegrTest('test_httplib.py'), RegrTest('test_httpservers.py'), - RegrTest('test_imageop.py', skip="unsupported extension module"), + RegrTest('test_imageop.py'), RegrTest('test_imaplib.py'), - RegrTest('test_imgfile.py', skip="unsupported extension module"), + RegrTest('test_imgfile.py'), RegrTest('test_imp.py', core=True, usemodules='thread'), RegrTest('test_import.py', core=True), RegrTest('test_importhooks.py', core=True), RegrTest('test_importlib.py'), + RegrTest('test_index.py'), RegrTest('test_inspect.py'), RegrTest('test_int.py', core=True), RegrTest('test_int_literal.py', core=True), @@ -296,7 +291,7 @@ RegrTest('test_long_future.py', core=True), RegrTest('test_longexp.py', core=True), RegrTest('test_macos.py'), - RegrTest('test_macostools.py', skip=True), + RegrTest('test_macostools.py'), RegrTest('test_macpath.py'), RegrTest('test_mailbox.py'), RegrTest('test_marshal.py', core=True), @@ -307,30 +302,29 @@ RegrTest('test_mhlib.py'), RegrTest('test_mimetools.py'), RegrTest('test_mimetypes.py'), - RegrTest('test_MimeWriter.py', core=False), + RegrTest('test_MimeWriter.py', core=False, usemodules='binascii'), RegrTest('test_minidom.py'), RegrTest('test_mmap.py', usemodules="mmap"), RegrTest('test_module.py', core=True), RegrTest('test_modulefinder.py'), - RegrTest('test_msilib.py', skip=only_win32), + RegrTest('test_msilib.py'), RegrTest('test_multibytecodec.py', usemodules='_multibytecodec'), - RegrTest('test_multibytecodec_support.py', skip="not a test"), RegrTest('test_multifile.py'), - RegrTest('test_multiprocessing.py', skip="FIXME leaves subprocesses"), + RegrTest('test_multiprocessing.py', skip=True), RegrTest('test_mutants.py', core="possibly"), RegrTest('test_mutex.py'), RegrTest('test_netrc.py'), RegrTest('test_new.py', core=True), - RegrTest('test_nis.py', skip="unsupported extension module"), + RegrTest('test_nis.py'), RegrTest('test_normalization.py'), RegrTest('test_ntpath.py'), + RegrTest('test_old_mailbox.py'), RegrTest('test_opcodes.py', core=True), RegrTest('test_openpty.py'), RegrTest('test_operator.py', core=True), RegrTest('test_optparse.py'), - RegrTest('test_os.py', core=True), - RegrTest('test_ossaudiodev.py', skip="unsupported extension module"), + RegrTest('test_ossaudiodev.py'), RegrTest('test_parser.py', skip="slowly deprecating compiler"), RegrTest('test_pdb.py'), RegrTest('test_peepholer.py'), @@ -338,14 +332,16 @@ RegrTest('test_pep263.py'), RegrTest('test_pep277.py'), RegrTest('test_pep292.py'), + RegrTest('test_pep352.py'), RegrTest('test_pickle.py', core=True), RegrTest('test_pickletools.py', core=False), RegrTest('test_pipes.py'), RegrTest('test_pkg.py', core=True), RegrTest('test_pkgimport.py', core=True), RegrTest('test_pkgutil.py'), - RegrTest('test_plistlib.py', skip="unsupported module"), - RegrTest('test_poll.py', skip=skip_win32), + RegrTest('test_platform.py'), + RegrTest('test_plistlib.py'), + RegrTest('test_poll.py'), RegrTest('test_popen.py'), RegrTest('test_popen2.py'), RegrTest('test_poplib.py'), @@ -357,8 +353,8 @@ RegrTest('test_profile.py'), RegrTest('test_property.py', core=True), RegrTest('test_pstats.py'), - RegrTest('test_pty.py', skip="unsupported extension module"), - RegrTest('test_pwd.py', usemodules="pwd", skip=skip_win32), + RegrTest('test_pty.py', usemodules='fcntl termios select'), + RegrTest('test_pwd.py', usemodules="pwd"), RegrTest('test_py3kwarn.py'), RegrTest('test_py_compile.py'), RegrTest('test_pyclbr.py'), @@ -370,15 +366,15 @@ RegrTest('test_re.py', core=True), RegrTest('test_readline.py'), RegrTest('test_repr.py', core=True), - RegrTest('test_resource.py', skip=skip_win32), + RegrTest('test_resource.py'), RegrTest('test_rfc822.py'), RegrTest('test_richcmp.py', core=True), RegrTest('test_rlcompleter.py'), - RegrTest('test_robotparser.py'), + RegrTest('test_runpy.py'), RegrTest('test_sax.py'), RegrTest('test_scope.py', core=True), - RegrTest('test_scriptpackages.py', skip="unsupported extension module"), + RegrTest('test_scriptpackages.py'), RegrTest('test_select.py'), RegrTest('test_set.py', core=True), RegrTest('test_sets.py'), @@ -389,64 +385,59 @@ RegrTest('test_shlex.py'), RegrTest('test_shutil.py'), RegrTest('test_signal.py'), - RegrTest('test_SimpleHTTPServer.py'), + RegrTest('test_SimpleHTTPServer.py', usemodules='binascii'), RegrTest('test_site.py', core=False), RegrTest('test_slice.py', core=True), RegrTest('test_smtplib.py'), RegrTest('test_smtpnet.py'), RegrTest('test_socket.py', usemodules='thread _weakref'), - RegrTest('test_socketserver.py', usemodules='thread'), - RegrTest('test_softspace.py', core=True), RegrTest('test_sort.py', core=True), + RegrTest('test_sqlite.py', usemodules="thread _rawffi zlib"), RegrTest('test_ssl.py', usemodules='_ssl _socket select'), + RegrTest('test_startfile.py'), RegrTest('test_str.py', core=True), - RegrTest('test_strftime.py'), RegrTest('test_string.py', core=True), - RegrTest('test_StringIO.py', core=True, usemodules='cStringIO'), + RegrTest('test_StringIO.py', core=True, usemodules='cStringIO array'), RegrTest('test_stringprep.py'), RegrTest('test_strop.py', skip="deprecated"), - RegrTest('test_strptime.py'), RegrTest('test_strtod.py'), RegrTest('test_struct.py', usemodules='struct'), RegrTest('test_structmembers.py', skip="CPython specific"), RegrTest('test_structseq.py'), RegrTest('test_subprocess.py', usemodules='signal'), - RegrTest('test_sunaudiodev.py', skip=True), + RegrTest('test_sunaudiodev.py'), RegrTest('test_sundry.py'), RegrTest('test_symtable.py', skip="implementation detail"), RegrTest('test_syntax.py', core=True), RegrTest('test_sys.py', core=True, usemodules='struct'), + RegrTest('test_sys_setprofile.py', core=True), RegrTest('test_sys_settrace.py', core=True), - RegrTest('test_sys_setprofile.py', core=True), RegrTest('test_sysconfig.py'), - RegrTest('test_tcl.py', skip="unsupported extension module"), RegrTest('test_tarfile.py'), + RegrTest('test_tcl.py'), RegrTest('test_telnetlib.py'), RegrTest('test_tempfile.py'), - RegrTest('test_textwrap.py'), RegrTest('test_thread.py', usemodules="thread", core=True), RegrTest('test_threaded_import.py', usemodules="thread", core=True), RegrTest('test_threadedtempfile.py', usemodules="thread", core=False), - RegrTest('test_threading.py', usemodules="thread", core=True), RegrTest('test_threading_local.py', usemodules="thread", core=True), RegrTest('test_threadsignals.py', usemodules="thread"), - RegrTest('test_time.py', core=True), RegrTest('test_timeout.py'), RegrTest('test_tk.py'), - RegrTest('test_ttk_guionly.py'), - RegrTest('test_ttk_textonly.py'), RegrTest('test_tokenize.py'), RegrTest('test_trace.py'), RegrTest('test_traceback.py', core=True), RegrTest('test_transformer.py', core=True), + RegrTest('test_ttk_guionly.py'), + RegrTest('test_ttk_textonly.py'), RegrTest('test_tuple.py', core=True), RegrTest('test_typechecks.py'), RegrTest('test_types.py', core=True), @@ -462,6 +453,7 @@ RegrTest('test_unpack.py', core=True), RegrTest('test_urllib.py'), RegrTest('test_urllib2.py'), + RegrTest('test_urllib2_localnet.py', usemodules="thread"), RegrTest('test_urllib2net.py'), RegrTest('test_urllibnet.py'), RegrTest('test_urlparse.py'), @@ -469,61 +461,38 @@ RegrTest('test_userlist.py', core=True), RegrTest('test_userstring.py', core=True), RegrTest('test_uu.py'), - - RegrTest('test_warnings.py', core=True), - RegrTest('test_wave.py', skip="unsupported extension module"), - RegrTest('test_weakref.py', core=True, usemodules='_weakref'), - RegrTest('test_weakset.py'), - - RegrTest('test_whichdb.py'), - RegrTest('test_winreg.py', skip=only_win32), - RegrTest('test_winsound.py', skip="unsupported extension module"), - RegrTest('test_xmllib.py'), - RegrTest('test_xmlrpc.py'), - - RegrTest('test_xpickle.py'), - RegrTest('test_xrange.py', core=True), - RegrTest('test_zipfile.py'), - RegrTest('test_zipimport.py', usemodules='zlib zipimport'), - RegrTest('test_zipimport_support.py', usemodules='zlib zipimport'), - RegrTest('test_zlib.py', usemodules='zlib'), - - RegrTest('test_bigaddrspace.py'), - RegrTest('test_bigmem.py'), - RegrTest('test_cmd_line.py'), - RegrTest('test_code.py'), - RegrTest('test_coding.py'), - RegrTest('test_complex_args.py'), - RegrTest('test_contextlib.py', usemodules="thread"), - RegrTest('test_ctypes.py', usemodules="_rawffi thread"), - RegrTest('test_defaultdict.py', usemodules='_collections'), - RegrTest('test_email_renamed.py'), - RegrTest('test_exception_variations.py'), - RegrTest('test_float.py'), - RegrTest('test_functools.py'), - RegrTest('test_index.py'), - RegrTest('test_old_mailbox.py'), - RegrTest('test_pep352.py'), - RegrTest('test_platform.py'), - RegrTest('test_runpy.py'), - RegrTest('test_sqlite.py', usemodules="thread _rawffi zlib"), - RegrTest('test_startfile.py', skip="bogus test"), - RegrTest('test_structmembers.py', skip="depends on _testcapi"), - RegrTest('test_urllib2_localnet.py', usemodules="thread"), RegrTest('test_uuid.py'), RegrTest('test_wait3.py', usemodules="thread"), RegrTest('test_wait4.py', usemodules="thread"), + RegrTest('test_warnings.py', core=True), + RegrTest('test_wave.py'), + RegrTest('test_weakref.py', core=True, usemodules='_weakref'), + RegrTest('test_weakset.py'), + RegrTest('test_whichdb.py'), + RegrTest('test_winreg.py'), + RegrTest('test_winsound.py'), RegrTest('test_with.py'), RegrTest('test_wsgiref.py'), RegrTest('test_xdrlib.py'), RegrTest('test_xml_etree.py'), RegrTest('test_xml_etree_c.py'), + RegrTest('test_xmllib.py'), + RegrTest('test_xmlrpc.py'), + RegrTest('test_xpickle.py'), + RegrTest('test_xrange.py', core=True), + RegrTest('test_zipfile.py'), RegrTest('test_zipfile64.py'), + RegrTest('test_zipimport.py', usemodules='zlib zipimport'), + RegrTest('test_zipimport_support.py', usemodules='zlib zipimport'), + RegrTest('test_zlib.py', usemodules='zlib'), ] def check_testmap_complete(): listed_names = dict.fromkeys([regrtest.basename for regrtest in testmap]) - listed_names['test_support.py'] = True # ignore this + assert len(listed_names) == len(testmap) + # names to ignore + listed_names['test_support.py'] = True + listed_names['test_multibytecodec_support.py'] = True missing = [] for path in testdir.listdir(fil='test_*.py'): name = path.basename @@ -578,7 +547,7 @@ def getinvocation(self, regrtest): fspath = regrtest.getfspath() python = sys.executable - pypy_script = pypydir.join('bin', 'py.py') + pypy_script = pypydir.join('bin', 'pyinteractive.py') alarm_script = pypydir.join('tool', 'alarm.py') if sys.platform == 'win32': watchdog_name = 'watchdog_nt.py' diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py --- a/pypy/interpreter/executioncontext.py +++ b/pypy/interpreter/executioncontext.py @@ -343,9 +343,13 @@ signal, the tick counter is set to -1 by C code in signals.h. """ assert isinstance(action, PeriodicAsyncAction) - self._periodic_actions.append(action) + # hack to put the release-the-GIL one at the end of the list, + # and the report-the-signals one at the start of the list. if use_bytecode_counter: + self._periodic_actions.append(action) self.has_bytecode_counter = True + else: + self._periodic_actions.insert(0, action) self._rebuild_action_dispatcher() def getcheckinterval(self): @@ -419,15 +423,6 @@ The action must have been registered at space initalization time.""" self.space.actionflag.fire(self) - def fire_after_thread_switch(self): - """Bit of a hack: fire() the action but only the next time the GIL - is released and re-acquired (i.e. after a potential thread switch). - Don't call this if threads are not enabled. Currently limited to - one action (i.e. reserved for CheckSignalAction from module/signal). - """ - from pypy.module.thread.gil import spacestate - spacestate.action_after_thread_switch = self - def perform(self, executioncontext, frame): """To be overridden.""" diff --git a/pypy/module/_multiprocessing/test/test_connection.py b/pypy/module/_multiprocessing/test/test_connection.py --- a/pypy/module/_multiprocessing/test/test_connection.py +++ b/pypy/module/_multiprocessing/test/test_connection.py @@ -68,7 +68,7 @@ assert rhandle.readable class AppTestWinpipeConnection(BaseConnectionTest): - spaceconfig = dict(usemodules=('_multiprocessing', 'thread')) + spaceconfig = dict(usemodules=('_multiprocessing', 'thread', 'signal')) def setup_class(cls): if sys.platform != "win32": diff --git a/pypy/module/_socket/interp_socket.py b/pypy/module/_socket/interp_socket.py --- a/pypy/module/_socket/interp_socket.py +++ b/pypy/module/_socket/interp_socket.py @@ -181,7 +181,8 @@ try: self.close() except SocketError, e: - raise converted_error(space, e) + # cpython doesn't return any errors on close + pass def connect_w(self, space, w_addr): """connect(address) @@ -448,7 +449,7 @@ w_addr = space.w_None return space.newtuple([space.wrap(readlgt), w_addr]) except SocketError, e: - raise converted_error(space, e) + raise converted_error(space, e) @unwrap_spec(cmd=int) def ioctl_w(self, space, cmd, w_option): diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py --- a/pypy/module/_socket/test/test_sock_app.py +++ b/pypy/module/_socket/test/test_sock_app.py @@ -362,13 +362,15 @@ assert isinstance(s.fileno(), int) def test_socket_close(self): - import _socket + import _socket, os s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM, 0) fileno = s.fileno() assert s.fileno() >= 0 s.close() assert s.fileno() < 0 s.close() + if os.name != 'nt': + raises(OSError, os.close, fileno) def test_socket_close_error(self): import _socket, os @@ -376,7 +378,7 @@ skip("Windows sockets are not files") s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM, 0) os.close(s.fileno()) - raises(_socket.error, s.close) + s.close() def test_socket_connect(self): import _socket, os diff --git a/pypy/module/crypt/test/test_crypt.py b/pypy/module/crypt/test/test_crypt.py --- a/pypy/module/crypt/test/test_crypt.py +++ b/pypy/module/crypt/test/test_crypt.py @@ -1,6 +1,12 @@ +import os +import py + +if os.name != 'posix': + py.test.skip('crypt module only available on unix') + class AppTestCrypt: spaceconfig = dict(usemodules=['crypt']) - + def test_crypt(self): import crypt res = crypt.crypt("pass", "ab") diff --git a/pypy/module/fcntl/test/test_fcntl.py b/pypy/module/fcntl/test/test_fcntl.py --- a/pypy/module/fcntl/test/test_fcntl.py +++ b/pypy/module/fcntl/test/test_fcntl.py @@ -1,9 +1,9 @@ import os +import py from rpython.tool.udir import udir -if os.name == "nt": - from py.test import skip - skip("fcntl module is not available on Windows") +if os.name != 'posix': + py.test.skip("fcntl module only available on unix") def teardown_module(mod): for i in "abcde": diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -823,14 +823,19 @@ if hasattr(os, 'chmod'): def test_chmod(self): + import sys os = self.posix os.unlink(self.path) raises(OSError, os.chmod, self.path, 0600) f = open(self.path, "w") f.write("this is a test") f.close() - os.chmod(self.path, 0200) - assert (os.stat(self.path).st_mode & 0777) == 0200 + if sys.platform == 'win32': + os.chmod(self.path, 0400) + assert (os.stat(self.path).st_mode & 0600) == 0400 + else: + os.chmod(self.path, 0200) + assert (os.stat(self.path).st_mode & 0777) == 0200 if hasattr(os, 'fchmod'): def test_fchmod(self): diff --git a/pypy/module/pwd/test/test_pwd.py b/pypy/module/pwd/test/test_pwd.py --- a/pypy/module/pwd/test/test_pwd.py +++ b/pypy/module/pwd/test/test_pwd.py @@ -1,3 +1,9 @@ +import os +import py + +if os.name != 'posix': + py.test.skip('pwd module only available on unix') + class AppTestPwd: spaceconfig = dict(usemodules=['pwd']) diff --git a/pypy/module/signal/interp_signal.py b/pypy/module/signal/interp_signal.py --- a/pypy/module/signal/interp_signal.py +++ b/pypy/module/signal/interp_signal.py @@ -8,7 +8,8 @@ PeriodicAsyncAction) from pypy.interpreter.gateway import unwrap_spec -from rpython.rlib import jit, rposix +from rpython.rlib import jit, rposix, rgc +from rpython.rlib.objectmodel import we_are_translated from rpython.rlib.rarithmetic import intmask from rpython.rlib.rsignal import * from rpython.rtyper.lltypesystem import lltype, rffi @@ -31,6 +32,11 @@ p = pypysig_getaddr_occurred() p.c_value = value + @staticmethod + def rearm_ticker(): + p = pypysig_getaddr_occurred() + p.c_value = -1 + def decrement_ticker(self, by): p = pypysig_getaddr_occurred() value = p.c_value @@ -46,41 +52,63 @@ class CheckSignalAction(PeriodicAsyncAction): """An action that is automatically invoked when a signal is received.""" + # Note that this is a PeriodicAsyncAction: it means more precisely + # that it is called whenever the C-level ticker becomes < 0. + # Without threads, it is only ever set to -1 when we receive a + # signal. With threads, it also decrements steadily (but slowly). + def __init__(self, space): + "NOT_RPYTHON" AsyncAction.__init__(self, space) self.handlers_w = {} - self.emulated_sigint = False + self.pending_signal = -1 + self.fire_in_main_thread = False + if self.space.config.objspace.usemodules.thread: + from pypy.module.thread import gil + gil.after_thread_switch = self._after_thread_switch + + @rgc.no_collect + def _after_thread_switch(self): + if self.fire_in_main_thread: + if self.space.threadlocals.ismainthread(): + self.fire_in_main_thread = False + SignalActionFlag.rearm_ticker() + # this occurs when we just switched to the main thread + # and there is a signal pending: we force the ticker to + # -1, which should ensure perform() is called quickly. @jit.dont_look_inside def perform(self, executioncontext, frame): - if self.space.config.objspace.usemodules.thread: - main_ec = self.space.threadlocals.getmainthreadvalue() - in_main = executioncontext is main_ec - else: - in_main = True - # If we are in the main thread, poll and report the signals now. - if in_main: - if self.emulated_sigint: - self.emulated_sigint = False - self._report_signal(cpy_signal.SIGINT) - while True: - n = pypysig_poll() - if n < 0: - break + # Poll for the next signal, if any + n = self.pending_signal + if n < 0: n = pypysig_poll() + while n >= 0: + if self.space.config.objspace.usemodules.thread: + in_main = self.space.threadlocals.ismainthread() + else: + in_main = True + if in_main: + # If we are in the main thread, report the signal now, + # and poll more + self.pending_signal = -1 self._report_signal(n) - else: - # Otherwise, don't call pypysig_poll() at all. Instead, - # arrange for perform() to be called again after a thread - # switch. It might be called again and again, until we - # land in the main thread. - self.fire_after_thread_switch() + n = self.pending_signal + if n < 0: n = pypysig_poll() + else: + # Otherwise, arrange for perform() to be called again + # after we switch to the main thread. + self.pending_signal = n + self.fire_in_main_thread = True + break - @jit.dont_look_inside def set_interrupt(self): "Simulates the effect of a SIGINT signal arriving" - ec = self.space.getexecutioncontext() - self.emulated_sigint = True - self.perform(ec, None) + if not we_are_translated(): + self.pending_signal = cpy_signal.SIGINT + # ^^^ may override another signal, but it's just for testing + else: + pypysig_pushback(cpy_signal.SIGINT) + self.fire_in_main_thread = True def _report_signal(self, n): try: diff --git a/pypy/module/termios/test/test_termios.py b/pypy/module/termios/test/test_termios.py --- a/pypy/module/termios/test/test_termios.py +++ b/pypy/module/termios/test/test_termios.py @@ -1,9 +1,12 @@ - +import os +import sys import py -import sys from pypy.conftest import pypydir from rpython.tool.udir import udir +if os.name != 'posix': + py.test.skip('termios module only available on unix') + class TestTermios(object): def setup_class(cls): try: diff --git a/pypy/module/thread/gil.py b/pypy/module/thread/gil.py --- a/pypy/module/thread/gil.py +++ b/pypy/module/thread/gil.py @@ -62,22 +62,7 @@ do_yield_thread() -class SpaceState: - - def _cleanup_(self): - self.action_after_thread_switch = None - # ^^^ set by AsyncAction.fire_after_thread_switch() - - def after_thread_switch(self): - # this is support logic for the signal module, to help it deliver - # signals to the main thread. - action = self.action_after_thread_switch - if action is not None: - self.action_after_thread_switch = None - action.fire() - -spacestate = SpaceState() -spacestate._cleanup_() +after_thread_switch = lambda: None # hook for signal.py # Fragile code below. We have to preserve the C-level errno manually... @@ -94,7 +79,7 @@ e = get_errno() thread.gil_acquire() thread.gc_thread_run() - spacestate.after_thread_switch() + after_thread_switch() set_errno(e) after_external_call._gctransformer_hint_cannot_collect_ = True after_external_call._dont_reach_me_in_del_ = True @@ -112,7 +97,7 @@ # the same thread). if thread.gil_yield_thread(): thread.gc_thread_run() - spacestate.after_thread_switch() + after_thread_switch() do_yield_thread._gctransformer_hint_close_stack_ = True do_yield_thread._dont_reach_me_in_del_ = True do_yield_thread._dont_inline_ = True diff --git a/pypy/module/thread/threadlocals.py b/pypy/module/thread/threadlocals.py --- a/pypy/module/thread/threadlocals.py +++ b/pypy/module/thread/threadlocals.py @@ -48,6 +48,9 @@ ident = self._mainthreadident return self._valuedict.get(ident, None) + def ismainthread(self): + return thread.get_ident() == self._mainthreadident + def getallvalues(self): return self._valuedict diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -113,6 +113,9 @@ if policy is None: from rpython.annotator.policy import AnnotatorPolicy policy = AnnotatorPolicy() + # XXX hack + annmodel.TLS.check_str_without_nul = ( + self.translator.config.translation.check_str_without_nul) graph, inputcells = self.get_call_parameters(function, args_s, policy) self.build_graph_types(graph, inputcells, complete_now=False) self.complete_helpers(policy) diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -446,7 +446,8 @@ class __extend__(pairtype(SomeChar, SomeChar)): def union((chr1, chr2)): - return SomeChar() + no_nul = chr1.no_nul and chr2.no_nul + return SomeChar(no_nul=no_nul) class __extend__(pairtype(SomeChar, SomeUnicodeCodePoint), @@ -664,14 +665,14 @@ def getitem((str1, int2)): getbookkeeper().count("str_getitem", int2) - return SomeChar() + return SomeChar(no_nul=str1.no_nul) getitem.can_only_throw = [] getitem_key = getitem def getitem_idx((str1, int2)): getbookkeeper().count("str_getitem", int2) - return SomeChar() + return SomeChar(no_nul=str1.no_nul) getitem_idx.can_only_throw = [IndexError] getitem_idx_key = getitem_idx diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -2068,7 +2068,23 @@ s = a.build_types(f, [annmodel.SomeString(no_nul=True)]) assert isinstance(s, annmodel.SomeString) assert s.no_nul - + + def test_getitem_str0(self): + def f(s, n): + if n == 1: + return s[0] + elif n == 2: + return s[1] + elif n == 3: + return s[1:] + return s + a = self.RPythonAnnotator() + a.translator.config.translation.check_str_without_nul = True + + s = a.build_types(f, [annmodel.SomeString(no_nul=True), + annmodel.SomeInteger()]) + assert isinstance(s, annmodel.SomeString) + assert s.no_nul def test_non_none_and_none_with_isinstance(self): class A(object): diff --git a/rpython/rlib/rcomplex.py b/rpython/rlib/rcomplex.py --- a/rpython/rlib/rcomplex.py +++ b/rpython/rlib/rcomplex.py @@ -566,3 +566,6 @@ def c_isnan(r, i): return isnan(r) or isnan(i) + +def c_isfinite(r, i): + return isfinite(r) and isfinite(i) diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py --- a/rpython/rlib/rposix.py +++ b/rpython/rlib/rposix.py @@ -247,6 +247,20 @@ else: return nt._getfullpathname(path.as_bytes()) +@specialize.argtype(0, 1) +def putenv(name, value): + if isinstance(name, str): + os.environ[name] = value + else: + os.environ[name.as_bytes()] = value.as_bytes() + +@specialize.argtype(0) +def unsetenv(name): + if isinstance(name, str): + del os.environ[name] + else: + del os.environ[name.as_bytes()] + if os.name == 'nt': from rpython.rlib import rwin32 os_kill = rwin32.os_kill diff --git a/rpython/rlib/rsignal.py b/rpython/rlib/rsignal.py --- a/rpython/rlib/rsignal.py +++ b/rpython/rlib/rsignal.py @@ -80,6 +80,8 @@ pypysig_poll = external('pypysig_poll', [], rffi.INT, threadsafe=False) # don't bother releasing the GIL around a call to pypysig_poll: it's # pointless and a performance issue +pypysig_pushback = external('pypysig_pushback', [rffi.INT], lltype.Void, + threadsafe=False) # don't use rffi.LONGP because the JIT doesn't support raw arrays so far struct_name = 'pypysig_long_struct' diff --git a/rpython/rlib/test/test_jit.py b/rpython/rlib/test/test_jit.py --- a/rpython/rlib/test/test_jit.py +++ b/rpython/rlib/test/test_jit.py @@ -35,8 +35,8 @@ assert driver.reds == ['a', 'b'] assert driver.numreds == 2 -@py.test.mark.xfail(reason="@inline off: see skipped failures in test_warmspot.") def test_jitdriver_inline(): + py.test.skip("@inline off: see skipped failures in test_warmspot.") driver = JitDriver(greens=[], reds='auto') calls = [] def foo(a, b): @@ -55,8 +55,8 @@ ('bar', 40, 2), ] -@py.test.mark.xfail(reason="@inline off: see skipped failures in test_warmspot.") def test_jitdriver_clone(): + py.test.skip("@inline off: see skipped failures in test_warmspot.") def bar(): pass def foo(): pass driver = JitDriver(greens=[], reds=[]) diff --git a/rpython/rlib/test/test_rcomplex.py b/rpython/rlib/test/test_rcomplex.py --- a/rpython/rlib/test/test_rcomplex.py +++ b/rpython/rlib/test/test_rcomplex.py @@ -260,3 +260,24 @@ rAssertAlmostEqual(expected[1], actual[1], abs_err=real_abs_err, msg=error_message) + +def test_isnan(): + assert not c.c_isnan(0, 0) + assert c.c_isnan(float('nan'), 0) + assert c.c_isnan(1, float('nan')) + assert not c.c_isnan(float('inf'), 0) + +def test_isinf(): + assert not c.c_isinf(0, 0) + assert c.c_isinf(float('inf'), 0) + assert c.c_isinf(float('-inf'), 0) + assert c.c_isinf(1, float('inf')) + assert not c.c_isinf(float('nan'), 0) + +def test_isfinite(): + assert c.c_isfinite(0, 0) + assert not c.c_isfinite(float('nan'), 0) + assert not c.c_isfinite(float('-inf'), 0) + assert not c.c_isfinite(0, float('nan')) + assert not c.c_isfinite(0, float('-inf')) + diff --git a/rpython/rlib/test/test_rposix.py b/rpython/rlib/test/test_rposix.py --- a/rpython/rlib/test/test_rposix.py +++ b/rpython/rlib/test/test_rposix.py @@ -141,3 +141,10 @@ assert rposix.is_valid_fd(fd) == 1 fid.close() assert rposix.is_valid_fd(fd) == 0 + + def test_putenv(self): + def f(): + rposix.putenv(self.path, self.path) + rposix.unsetenv(self.path) + + interpret(f, []) # does not crash diff --git a/rpython/rlib/test/test_signature.py b/rpython/rlib/test/test_signature.py --- a/rpython/rlib/test/test_signature.py +++ b/rpython/rlib/test/test_signature.py @@ -9,6 +9,7 @@ def annotate_at(f, policy=None): t = TranslationContext() + t.config.translation.check_str_without_nul = True a = t.buildannotator(policy=policy) a.annotate_helper(f, [model.s_ImpossibleValue]*f.func_code.co_argcount, policy=policy) return a @@ -112,6 +113,12 @@ return len(u) assert getsig(f) == [model.SomeUnicodeString(), model.SomeInteger()] +def test_str0(): + @signature(types.unicode0(), returns=types.str0()) + def f(u): + return 'str' + assert getsig(f) == [model.SomeUnicodeString(no_nul=True), + model.SomeString(no_nul=True)] def test_ptr(): policy = LowLevelAnnotatorPolicy() diff --git a/rpython/rlib/types.py b/rpython/rlib/types.py --- a/rpython/rlib/types.py +++ b/rpython/rlib/types.py @@ -24,9 +24,15 @@ def unicode(): return model.SomeUnicodeString() +def unicode0(): + return model.SomeUnicodeString(no_nul=True) + def str(): return model.SomeString() +def str0(): + return model.SomeString(no_nul=True) + def char(): return model.SomeChar() diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py b/rpython/rtyper/lltypesystem/ll2ctypes.py --- a/rpython/rtyper/lltypesystem/ll2ctypes.py +++ b/rpython/rtyper/lltypesystem/ll2ctypes.py @@ -32,6 +32,15 @@ except ImportError: class tlsobject(object): pass +try: + from threading import RLock +except ImportError: + class RLock(object): + def __enter__(self): + pass + def __exit__(self, *args): + pass +rlock = RLock() _POSIX = os.name == "posix" _MS_WINDOWS = os.name == "nt" @@ -694,10 +703,11 @@ return None def lltype2ctypes(llobj, normalize=True): - """Convert the lltype object 'llobj' to its ctypes equivalent. - 'normalize' should only be False in tests, where we want to - inspect the resulting ctypes object manually. - """ + """Convert the lltype object 'llobj' to its ctypes equivalent. + 'normalize' should only be False in tests, where we want to + inspect the resulting ctypes object manually. + """ + with rlock: if isinstance(llobj, lltype._uninitialized): return uninitialized2ctypes(llobj.TYPE) if isinstance(llobj, llmemory.AddressAsInt): @@ -875,9 +885,10 @@ return llobj def ctypes2lltype(T, cobj): - """Convert the ctypes object 'cobj' to its lltype equivalent. - 'T' is the expected lltype type. - """ + """Convert the ctypes object 'cobj' to its lltype equivalent. + 'T' is the expected lltype type. + """ + with rlock: if T is lltype.Void: return None if isinstance(T, lltype.Typedef): @@ -1176,10 +1187,11 @@ #self.funcptr = ... set later def __call__(self, *argvalues): - if self.trampoline is None: - # lazily build the corresponding ctypes function object - cfunc = get_ctypes_callable(self.funcptr, self.calling_conv) - self.trampoline = get_ctypes_trampoline(self.FUNCTYPE, cfunc) + with rlock: + if self.trampoline is None: + # lazily build the corresponding ctypes function object + cfunc = get_ctypes_callable(self.funcptr, self.calling_conv) + self.trampoline = get_ctypes_trampoline(self.FUNCTYPE, cfunc) # perform the call return self.trampoline(*argvalues) @@ -1215,8 +1227,9 @@ return ctypes2lltype(RESULT, cres) return invoke_via_ctypes + def force_cast(RESTYPE, value): - """Cast a value to a result type, trying to use the same rules as C.""" + with rlock: if not isinstance(RESTYPE, lltype.LowLevelType): raise TypeError("rffi.cast() first arg should be a TYPE") if isinstance(value, llmemory.AddressAsInt): diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py --- a/rpython/rtyper/lltypesystem/rffi.py +++ b/rpython/rtyper/lltypesystem/rffi.py @@ -867,6 +867,8 @@ array[len(l)] = lltype.nullptr(CCHARP.TO) return array liststr2charpp._annenforceargs_ = [[annmodel.s_Str0]] # List of strings +# Make a copy for the ll_os.py module +ll_liststr2charpp = func_with_new_name(liststr2charpp, 'll_liststr2charpp') def free_charpp(ref): """ frees list of char**, NULL terminated diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py --- a/rpython/rtyper/module/ll_os.py +++ b/rpython/rtyper/module/ll_os.py @@ -306,7 +306,7 @@ rffi.INT, compilation_info = eci) def execv_llimpl(path, args): - l_args = rffi.liststr2charpp(args) + l_args = rffi.ll_liststr2charpp(args) os_execv(path, l_args) rffi.free_charpp(l_args) raise OSError(rposix.get_errno(), "execv failed") @@ -332,8 +332,8 @@ envstr = "%s=%s" % item envstrs.append(envstr) - l_args = rffi.liststr2charpp(args) - l_env = rffi.liststr2charpp(envstrs) + l_args = rffi.ll_liststr2charpp(args) + l_env = rffi.ll_liststr2charpp(envstrs) os_execve(path, l_args, l_env) # XXX untested @@ -357,7 +357,7 @@ def spawnv_llimpl(mode, path, args): mode = rffi.cast(rffi.INT, mode) - l_args = rffi.liststr2charpp(args) + l_args = rffi.ll_liststr2charpp(args) childpid = os_spawnv(mode, path, l_args) rffi.free_charpp(l_args) if childpid == -1: @@ -380,8 +380,8 @@ envstrs.append("%s=%s" % item) mode = rffi.cast(rffi.INT, mode) - l_args = rffi.liststr2charpp(args) - l_env = rffi.liststr2charpp(envstrs) + l_args = rffi.ll_liststr2charpp(args) + l_env = rffi.ll_liststr2charpp(envstrs) childpid = os_spawnve(mode, path, l_args, l_env) rffi.free_charpp(l_env) rffi.free_charpp(l_args) diff --git a/rpython/rtyper/rstr.py b/rpython/rtyper/rstr.py --- a/rpython/rtyper/rstr.py +++ b/rpython/rtyper/rstr.py @@ -80,7 +80,7 @@ assert s is not None bytes = self.runicode_encode_utf_8( s, len(s), 'strict', - errorhandler=self.ll_raise_unicode_exception_decode, + errorhandler=self.ll_raise_unicode_exception_encode, allow_surrogates=False) return self.ll.llstr(bytes) diff --git a/rpython/rtyper/test/test_runicode.py b/rpython/rtyper/test/test_runicode.py --- a/rpython/rtyper/test/test_runicode.py +++ b/rpython/rtyper/test/test_runicode.py @@ -106,6 +106,12 @@ assert self.ll_to_string(self.interpret(f, [38])) == f(38) + def g(n): + x = u'\ud800' + unichr(n) + return x.encode('utf-8') + + self.interpret_raises(UnicodeEncodeError, g, [38]) + def test_utf_8_encoding_annotation(self): from rpython.rlib.runicode import unicode_encode_utf_8 def errorhandler(errors, encoding, msg, u, diff --git a/rpython/tool/stdlib_opcode.py b/rpython/tool/stdlib_opcode.py --- a/rpython/tool/stdlib_opcode.py +++ b/rpython/tool/stdlib_opcode.py @@ -71,10 +71,14 @@ def to_globals(self, globals_dict): """NOT_RPYTHON. Add individual opcodes to the module constants.""" - globals_dict.update(self.opmap) - globals_dict['SLICE'] = self.opmap["SLICE+0"] - globals_dict['STORE_SLICE'] = self.opmap["STORE_SLICE+0"] - globals_dict['DELETE_SLICE'] = self.opmap["DELETE_SLICE+0"] + for name, value in self.opmap.iteritems(): + # Rename 'STORE_SLICE+0' opcodes + if name.endswith('+0'): + name = name[:-2] + # Ignore 'STORE_SLICE+1' opcodes + elif name.endswith(('+1', '+2', '+3')): + continue + globals_dict[name] = value def __str__(self): return "<%s bytecode>" % (self.name,) @@ -83,4 +87,4 @@ from opcode import opmap, HAVE_ARGUMENT -host_bytecode_spec = BytecodeSpec('host', opmap, HAVE_ARGUMENT) \ No newline at end of file +host_bytecode_spec = BytecodeSpec('host', opmap, HAVE_ARGUMENT) diff --git a/rpython/translator/c/src/signals.c b/rpython/translator/c/src/signals.c --- a/rpython/translator/c/src/signals.c +++ b/rpython/translator/c/src/signals.c @@ -71,7 +71,7 @@ #endif } -static void signal_setflag_handler(int signum) +void pypysig_pushback(int signum) { if (0 <= signum && signum < NSIG) { @@ -79,6 +79,11 @@ pypysig_occurred = 1; pypysig_counter.value = -1; } +} + +static void signal_setflag_handler(int signum) +{ + pypysig_pushback(signum); if (wakeup_fd != -1) { diff --git a/rpython/translator/c/src/signals.h b/rpython/translator/c/src/signals.h --- a/rpython/translator/c/src/signals.h +++ b/rpython/translator/c/src/signals.h @@ -11,6 +11,7 @@ /* utility to poll for signals that arrived */ int pypysig_poll(void); /* => signum or -1 */ +void pypysig_pushback(int signum); /* When a signal is received, pypysig_counter is set to -1. */ /* This is a struct for the JIT. See rsignal.py. */ _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit