[pypy-svn] pypy default: Add a failing test which shows why sockets are completely broken on Windows
amauryfa
commits-noreply at bitbucket.org
Wed Jan 19 17:04:54 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r40929:bf32876b4928
Date: 2011-01-19 17:02 +0100
http://bitbucket.org/pypy/pypy/changeset/bf32876b4928/
Log: Add a failing test which shows why sockets are completely broken on
Windows
diff --git a/pypy/interpreter/test/test_appinterp.py b/pypy/interpreter/test/test_appinterp.py
--- a/pypy/interpreter/test/test_appinterp.py
+++ b/pypy/interpreter/test/test_appinterp.py
@@ -160,3 +160,26 @@
w_str = space1.getattr(w_mymod1, space1.wrap("hi"))
assert space1.str_w(w_str) == "hello"
+
+ def test_geninterp_can_unfreeze(self):
+ # When a module contains an "import" statement in applevel code, the
+ # imported module is initialized, possibly after it has been already
+ # frozen.
+
+ # This is important when the module startup() function does something
+ # at runtime, like setting os.environ (posix module) or initializing
+ # the winsock library (_socket module)
+ from pypy.conftest import gettestobjspace
+ space = gettestobjspace(usemodules=('_ssl', '_socket'))
+
+ w_socket = space.builtin_modules['_socket']
+ w_ssl = space.builtin_modules['_ssl']
+
+ # Uncomment this line for a workaround
+ # space.getattr(w_ssl, space.wrap('SSLError'))
+
+ w_socket._freeze_()
+ assert w_socket.startup_called == False
+ w_ssl._freeze_() # w_ssl.appleveldefs['SSLError'] imports _socket
+ assert w_socket.startup_called == False
+
More information about the Pypy-commit
mailing list