[issue13628] python-gdb.py: patch to improve support of optimized Python

2011-12-19 Thread STINNER Victor
STINNER Victor added the comment: > It is possible to retrieve "f" from the caller, PyEval_EvalCodeEx() It does not always work, but it works sometimes, so it's better to try :-) I applied my fix to Python 2.7, 3.2 and 3.3. lipython.py of Python 2.7 is outdated, it should

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: > Currently when running Python on a non-OSX posix environment > under either the C locale, or with an invalid or missing locale, > it's not possible to operate using unicode filenames outside > the ascii range. It was already discussed:

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: > under either the C locale, or with an invalid or missing locale The right fix is to fix your locale, not Python. -- ___ Python tracker <http://bugs.python.org/issu

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: > If there was a separate LC_FILENAMES then Python could respect > that and insist people set it, but there isn't. During 1 month, we had PYTHONFSENCODING environment variable. It was not a good idea. Again: please read the discussion (in cl

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: > There are two problems with this: one is just the practical > one that it scales poorly to have to tell every user to do this > and to take them through working out how to set this in a way > that covers cron jobs, daemons, things run over ssh, e

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: > The main problem I see being discussed is that > changing the encoding after Python starts would > be dangerous, which I agree with, but we're not > proposing to do that. Not after Python start. Using two encodings at the same would just a

[issue13619] Add a new codec: "locale", the current locale encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: I would be possible to implement incremental decoder with mbsrtowcs() and incremental encoder with wcsrtombs(), by serializing mbstate_t to a long integer (TextIOWrapper.tell() does something like that). The problem is that mbsrtowcs() and wcsrtombs() are

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-20 Thread STINNER Victor
STINNER Victor added the comment: I should not write comments so late :-p > Not after Python start. Using two encodings at the same would just ... at the same time > ... because I would like to inconsistency. because it would lead to inconsist

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: > Having more than one encoding on unix is already a reality, there's nothing > to stop someone setting LANG=de_DE.UTF-8 and LC_MESSAGES=C say. Nope. The locale encoding is chosen using LC_ALL, LC_CTYPE or LANG variable: use the first non-emp

[issue13636] Python SSL Stack doesn't have a Secure Default set of ciphers

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: > By default the Python SSL/TLS Stack (client/server) expose > unsecure protocols (SSLv2) and unsecure ciphers (EXPORT 40bit DES). If there is a problem, it should not be fixed in Python, but in the underlying library (OpenSSL) or in applications. Pytho

[issue13639] UnicodeDecodeError when creating tar.gz with unicode name

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: + self.name = self.name.encode("iso-8859-1", "replace") Why did you chose ISO-8859-1? I think that the filesystem encoding should be used instead: -self.name = self.name.encode("iso-8859-1", "replace") +

[issue8604] Adding an atomic FS write API

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: > I'm not sure about the best module to host this, though: os.path ? Some OS don't provide atomic rename. If we only define a function when it is atomic (as we do in the posix module, only expose functions available on the OS), programs will

[issue13639] UnicodeDecodeError when creating tar.gz with unicode name

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: "The gzip format (defined in RFC 1952) allows storing the original filename (without the .gz suffix) in an additional field in the header (the FNAME field). Latin-1 (iso-8859-1) is required." Hum, it looks like the author of the gzip program (on Li

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: > it will still be passing values that can't be > interpreted by other processes as you highlighed earlier. On UNIX, data going outside Python has be be encoded: you pass byte strings, not directly Unicode. Surrogates are encoded back to ori

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: This discussion is becoming very long, I didn't remember the original purpose. You want to use UTF-8 instead of ASCII, so what? What do you want to do with your nicely well decoded filenames? You cannot print it to your terminal nor pass it to a subpr

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: >> Nope. The locale encoding is chosen using LC_ALL, LC_CTYPE or LANG >> variable: use the first non-empty variable. LC_MESSAGES doesn't affect >> the encoding. Example: > > That's good to know, thanks. Only leaves the case

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: On 22/12/2011 02:16, Martin Pool wrote: > The proposal is that in some cases where Python currently assumes > filenames are ascii on Linux, it ought to instead assume they are > utf-8. Oh, I expected a use case describing the problem, not the

[issue13643] 'ascii' is a bad filesystem default encoding

2011-12-21 Thread STINNER Victor
STINNER Victor added the comment: > The problem as I see it is this: > > On Linux, filenames are generally (but not always) in UTF-8; people > fairly commonly end up with no locale configured, which causes Python > to decode filenames as ascii. It is easy for this to end up with

[issue13619] Add a new codec: "locale", the current locale encoding

2011-12-22 Thread STINNER Victor
STINNER Victor added the comment: + encoding = locale.getpreferredencoding() It should be locale.getpreferredencoding(False). -- ___ Python tracker <http://bugs.python.org/issue13

[issue13078] IDLE: Python Crashes When Saving Or Opening

2011-12-22 Thread STINNER Victor
Changes by STINNER Victor : -- title: Python Crashes When Saving Or Opening -> IDLE: Python Crashes When Saving Or Opening ___ Python tracker <http://bugs.python.org/issu

[issue13565] test_multiprocessing.test_notify_all() hangs on "AMD64 Snow Leopard 02 03.x"

2011-12-23 Thread STINNER Victor
STINNER Victor added the comment: > Victor, could you try the attached script on FreeBSD, > to see if you get ECONNREFUSED? Yes, I get a ECONNREFUSED. I tested backlog.py on FreeBSD 8.2. -- ___ Python tracker <http://bugs.python.org/i

[issue13674] crash in datetime.strftime

2011-12-29 Thread STINNER Victor
STINNER Victor added the comment: timemodule.c has the following check: #if defined(_MSC_VER) || defined(sun) if (buf.tm_year + 1900 < 1 || < buf.tm_year + 1900) { PyErr_SetString(PyExc_ValueError, "strftime() requires year

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker <http://bugs.python.org/issue13703> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: > Unless there's evidence of performance regressions > or backward incompatibilities, I agree. If hash() is modified, str(dict) and str(set) will change for example. It may break doctests. Can we consider that the application should not rely (ind

[issue13704] Random number generator in Python core

2012-01-03 Thread STINNER Victor
Changes by STINNER Victor : -- keywords: +patch Added file: http://bugs.python.org/file24135/3106cc0a2024.diff ___ Python tracker <http://bugs.python.org/issue13

[issue13706] non-ascii fill characters no longer work in numeric formatting

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: > I assume this is left over from the PEP 393 changes. Correct. > I'm not sure such a restriction needs to exist any more. The restriction was introduced to simplify the implementation. maxchar has to be computed exactly in format_stri

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: Christian Heimes proposes the following change in its randomhash branch (see issue #13704): -x = (Py_uhash_t) *p << 7; +x = Py_RndHashSeed + ((Py_uhash_t) *p << 7); for (i = 0; i < len; i++) x = (103U * x) ^ (Py_uhash_

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: Paul first proposition (on python-dev) was to replace: ... x = (ord(s[0]) << 7) while i < length: x = intmask((103*x) ^ ord(s[i])) ... by: ... x = (ord(s[0]) << 7) while i < length: x =

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: > https://gist.github.com/0a91e52efa74f61858b5 Please, attach directly a file to the issue, or copy/paste the code in your comment. Interesting part the code: --- #Proposed replacement #-- import os, array size_expon

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: I read that the attack cannot be computed with actual computers (it's too expensive) against Python 64 bits. I tried to change str.__hash__ in Python 32 bits to compute the hash in 64 bits and than truncate the hash to 32 bits: it doesn't chang

[issue13697] python RLock implementation unsafe with signals

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: > This affects the python implementation of RLock only. In the issue #13550, it was discussed to remove completly the logging machinery from the threading module. If we remove it, we don't need the Python implementation of RLock. We already rem

[issue13699] test_gdb has recently started failing

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: "test_gdb has started failing recently on my Ubuntu Natty system: ... >>> sysconfig.get_config_vars()['PY_CFLAGS'] '-Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' ... Marking haypo as nosy since it migh

[issue13703] Hash collision security issue

2012-01-03 Thread STINNER Victor
STINNER Victor added the comment: Yet another random hash function, simplified version of Paul's function. It always use exactly 256 bits of entropy and so 32 bytes of memory, and doesn't keep the loop. I don't expect my function to be secure, but just give more work to

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: Work-in-progress patch implementing my randomized hash function (random.patch): - add PyOS_URandom() using CryptoGen, SSL (only on VMS!!) or /dev/urandom, will a fallback on a dummy LCG if the OS urandom failed - posix.urandom() is always defined and reuses

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: > add PyOS_URandom() using CryptoGen, SSL (only on VMS!!) > or /dev/urandom Oh, OpenSSL (RAND_pseudo_bytes) should be used on Windows, Linux, Mac OS X, etc. if OpenSSL is available. I was just too lazy to add a define or pyconfig.h option to indic

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: +printf("read %i bytes\n", size); Oops, I forgot a debug message. -- ___ Python tracker <http://bugs.python.o

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: > If PHP uses it, I'm confident it is secure. If I remember correctly, it is only used for the Windows version of PHP, but PHP doesn't implement it correctly because it uses all bits. -- ___ Python t

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: "Since speed is a concern, I think that the proposal to avoid using the random hash for short strings is a good idea." My proposition only adds two XOR to hash(str) (outside the loop on Unicode characters), so I expect a ridiculous overhead. I don&

[issue13699] test_gdb has recently started failing

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: > New changeset dfffb293f4b3 by Vinay Sajip in branch 'default' The fix should also be applied to 3.2. -- resolution: fixed -> status: closed -> open ___ Python tracker <http://bugs

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: > I fear that an attacker may guess the seed from several small strings hash(a) ^ hash(b) "removes" the suffix, but I don't see how to guess the prefix from this new value. It doesn't mean that it is not possible, just that I don'

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: "Calculating the hash of a null byte gives you the xor of your two seeds." Not directly because prefix is first multiplied by 103. So hash("\0") gives you (prefix*103) % 2^32 ^ suffix. Example: $ ./python secret={b7abfbbf, db6c

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: > At least for Python 2.x hash(str) and hash(unicode) have to yield > the same result for ASCII only strings. Ah yes, I forgot Python 2: I wrote my patch for Python 3.3. The two hash functions should be modified to be randomized. > hash("&q

[issue13703] Hash collision security issue

2012-01-04 Thread STINNER Victor
STINNER Victor added the comment: Patch version 2: - hash("") is always 0 - Remove a debug message -- Added file: http://bugs.python.org/file24143/random-2.patch ___ Python tracker <http://bugs.python.o

[issue13703] Hash collision security issue

2012-01-05 Thread STINNER Victor
STINNER Victor added the comment: > What I propose is to make the amount of information necessary > to analyze and generate collisions impractically large. Not only: the attacker has to compute the collisions for the new seed. I don't know how long it is, the code to generate co

[issue13609] Add "os.get_terminal_size()" function

2012-01-05 Thread STINNER Victor
STINNER Victor added the comment: Some comments about termsize.diff.3. I don't see why there are two functions, one should be enough: get_terminal_size() should be dropped, and query_terminal_size() renamed to get_terminal_size(). As said before, I don't think that reading ROWS an

[issue13703] Hash collision security issue

2012-01-05 Thread STINNER Victor
STINNER Victor added the comment: Note for myself, random-2.patch: _PyRandom_Init() must generate a prefix and a suffix different than zero (call PyOS_URandom in a loop, and fail after 100 tries). -- ___ Python tracker <http://bugs.python.

[issue13703] Hash collision security issue

2012-01-05 Thread STINNER Victor
STINNER Victor added the comment: "Given that a user has an application with an oracle function that returns the hash of a unicode string, an attacker can probe tenth of thousand one and two character unicode strings. That should give him/her enough data to calculate both seeds.

[issue13703] Hash collision security issue

2012-01-06 Thread STINNER Victor
STINNER Victor added the comment: hash-attack.patch does never decrement the collision counter. -- ___ Python tracker <http://bugs.python.org/issue13703> ___ ___

[issue13609] Add "os.get_terminal_size()" function

2012-01-06 Thread STINNER Victor
STINNER Victor added the comment: > - fd argument is retained, because we might want to test terminals >  opened with openpty. You mean a terminal different than the one used for stdin, stdout and stderr? > - two functions: still there. I think that get_terminal_size() should >

[issue10278] add time.wallclock() method

2012-01-08 Thread STINNER Victor
STINNER Victor added the comment: > on linux the underlying functionality is implemented in librt; the extension > doesn't check for this or links with -lrt. The changeset 35e4b7c4bafa changed configure.in to check clock_gettime(). It checks without and with librt: 7.7 +AC_

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
STINNER Victor added the comment: Version 3 of my patch: - Add PYTHONHASHSEED environment variable to get a fixed seed or to disable the randomized hash function (PYTHONHASHSEED=0) - Add tests on the randomized hash function - Add more tests on os.urandom() -- Added file: http

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
STINNER Victor added the comment: Patch version 4: - os.urandom() raises again exceptions on failure - drop support of VMS (which used RAND_pseudo_bytes from OpenSSL): I don't see how to link Python/random.c to libcrypto on VMS, I don't have VMS, and it don't see how it was

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
STINNER Victor added the comment: Patch version 5 fixes test_unicode for 64-bit system. -- Added file: http://bugs.python.org/file24198/random-5.patch ___ Python tracker <http://bugs.python.org/issue13

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file24142/random.patch ___ Python tracker <http://bugs.python.org/issue13703> ___ ___ Python-bugs-list m

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file24193/random-3.patch ___ Python tracker <http://bugs.python.org/issue13703> ___ ___ Python-bugs-list m

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file24143/random-2.patch ___ Python tracker <http://bugs.python.org/issue13703> ___ ___ Python-bugs-list m

[issue13703] Hash collision security issue

2012-01-10 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file24196/random-4.patch ___ Python tracker <http://bugs.python.org/issue13703> ___ ___ Python-bugs-list m

[issue13703] Hash collision security issue

2012-01-11 Thread STINNER Victor
STINNER Victor added the comment: >  * it is exceedingly complex Which part exactly? For hash(str), it just add two extra XOR. >  * the method would need to be implemented for all hashable Python types It was already discussed, and it was said that only hash(str) need to be mo

[issue13703] Hash collision security issue

2012-01-12 Thread STINNER Victor
STINNER Victor added the comment: Patch version 6: - remove a debug code in dev_urandom() (did always raise an exception for testing) - dev_urandom() raises an exception if open() fails - os.urandom() uses again the right exception type and message (instead of a generic exception

[issue13703] Hash collision security issue

2012-01-12 Thread STINNER Victor
STINNER Victor added the comment: I wrote bench_startup.py to measure the startup time on Windows. The precision of the script is quite bad because Windows timer has a bad resolution (e.g. 15.6 ms on Windows 7) :-/ In release mode, the best startup time is 45.2 ms without random, 50.9 ms

[issue13703] Hash collision security issue

2012-01-12 Thread STINNER Victor
STINNER Victor added the comment: SafeDict.py: with this solution, the hash of key has to be recomputed at each access to the dict (creation, get, set), the hash is not cached in the string object. -- ___ Python tracker <http://bugs.python.

[issue12073] regrtest: use faulthandler to dump the tracebacks on SIGUSR1

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: Update the patch and describe the new feature in regrtest doc (--help). -- Added file: http://bugs.python.org/file22067/regrtest_sigusr1-2.patch ___ Python tracker <http://bugs.python.org/issue12

[issue12100] Incremental encoders of CJK codecs reset the codec at each call to encode()

2011-05-22 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +loewis ___ Python tracker <http://bugs.python.org/issue12100> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: @charles-francois.natali: Your patch is ok, you can commit it into 3.1, 3.2, 3.3. But you may wait after 3.2.1. @Georg Brandl: Should we wait after Python 3.2.1 for this issue? -- nosy: +georg.brandl ___ Python

[issue12103] Documentation of open() does not claim 'e' support in mode string

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: Issue #12105 adds os.O_CLOEXEC flag, so we will be able to write open(os.open(filename, os.O_RDONLY|os.O_CLOEXEC)). Do you want to work on a doc patch? -- ___ Python tracker <http://bugs.python.org/issue12

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: >> open() documentation may explain the os.fdopen(os.open()) "trick" >> to use low-level options like O_SYNC or O_CLOEXEC. > Why not, but I leave it to someone more comfortable with > documentation than me :-) Issue #12103

[issue5715] listen socket close in SocketServer.ForkingMixIn.process_request()

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: I don't know if it's related, but SimpleXMLRPCServer in Python 2.7 uses fcntl(self.fileno(), fcntl.F_SETFD, flags): class SimpleXMLRPCServer(SocketServer.TCPServer, SimpleXMLRPCDispatcher): ... def __i

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: Oh, by the way: it would also be nice to add os.O_CLOEXEC to Python 2.7. For example, tempfile._mkstemp_inner() uses: fd = _os.open(file, flags, 0600) _set_cloexec(fd) # fcntl(fd, F_SETFD, flags | FD_CLOEXEC) which is not atomic

[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: > These changes cause test failure on 3.1 branch when verbose mode is disabled What a shame! I commited a debug "print()": 1.39 +print(fname) It should be fixed by my last commit. -- ___ P

[issue5715] listen socket close in SocketServer.ForkingMixIn.process_request()

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: > Patch looks fine to me. Is it easily testable? test_subprocess has some tests checking "cloexec": test_pipe_cloexec() and test_pipe_cloexec_real_tools(). You may reuse some code from these tests? -- _

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: > One moment -- adding a new value to the os module looks like a new > feature to me. Is there any convincing reason why this needs to go to > 3.2? (And it most definitely shouldn't go to 3.1.) Python doesn't suppose atomic open+CLOEXEC

[issue12151] test_logging fails sometimes

2011-05-22 Thread STINNER Victor
New submission from STINNER Victor : test_logging does sometimes fail. A recent example on Windows XP: http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/4645/steps/test/logs/stdio test test_logging failed -- Traceback (most recent call last): File "D:\cygwin\home

[issue12113] test_packaging fails when run twice

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: I cannot reproduce the problem: "python -m test test_packaging test_packaging". I suppose that it was fixed by tarek. -- nosy: +haypo resolution: -> fixed status: open -> closed ___ Pytho

[issue12121] test_packaging failure when ssl is not available

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: It looks like Tarek fixed this bug because I'm unable to reproduce it. -- nosy: +haypo resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.

[issue12150] test_sysconfig fails on solaris

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: Duplicate of #12125. -- nosy: +haypo resolution: -> duplicate status: open -> closed ___ Python tracker <http://bugs.python.org/i

[issue12125] test_sysconfig fails on OpenIndiana because of test_packaging

2011-05-22 Thread STINNER Victor
STINNER Victor added the comment: Issue #12150 has been marked as a duplicate of this issue: == ERROR: test_get_path (test.test_sysconfig.TestSysConfig

[issue12155] queue example doesn't stop worker threads

2011-05-23 Thread STINNER Victor
New submission from STINNER Victor : The queue doc contains the following example: -- def worker(): while True: item = q.get() do_work(item) q.task_done() q = Queue() for i in range(num_worker_threads): t = Thread(target=worker) t.daemon

[issue12156] test_multiprocessing

2011-05-23 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: haypo priority: normal severity: normal status: open title: test_multiprocessing ___ Python tracker <http://bugs.python.org/issue12

[issue12156] test_multiprocessing.test_notify_all() timeout (1 hour) on FreeBSD 7.2

2011-05-23 Thread STINNER Victor
New submission from STINNER Victor : http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%207.2%203.x/builds/1819/steps/test/logs/stdio [180/355] test_multiprocessing Timeout (1:00:00)! Thread 0x28401d00: File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/multiproce

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > or just skip the test on Linux kernels older than 2.6.23 I like this solution, but I don't know how to test that the kernel doesn't support O_CLOEXEC. My commit bff9265d677d will tell use the value of O_CLOEXEC on the "Linux-2.6.22-vs2

[issue5715] listen socket close in SocketServer.ForkingMixIn.process_request()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Oh, Linux 2.6.27+ has a SOCK_CLOEXEC option: we may use it (but it should be done in another issue). See also #12105. -- ___ Python tracker <http://bugs.python.org/issue5

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Story of O_CLOEXEC in the GNU libc, by Ulrich Drepper: "Secure File Descriptor Handling" http://udrepper.livejournal.com/20407.html -- > I could either add some voodoo configure checks to ensure > that O_CLOEXEC is indeed supported Hum, if

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Another idea is to write a best-effort function to open a file with CLOEXEC flag: * use O_CLOEXEC if available * use fcntl(fd, F_SETFD, flags | FD_CLOEXEC) if O_CLOEXEC is missing or was silently ignored by the kernel (by open) Attached open_cloexec.py is

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > My commit bff9265d677d will tell use the value of O_CLOEXEC on the > "Linux-2.6.22-vs2.2.0.7-gentoo-..." buildbot. Here you have: "AssertionError: 0 is not true : CLOEXEC flag not set (O_CLOEXEC=0x8)" It's the same value

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > The real issue is that the libc defines O_CLOEXEC, but kernels prior > to 2.6.23 don't support it: instead of returning EINVAL, the socket > syscall silently ignores the flag (don't know why I made the comment > about this flag being d

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
New submission from STINNER Victor : Sometimes, we need to know the version of the Linux kernel. Recent examples: test if SOCK_CLOEXEC or O_CLOEXEC are supported by the kernel or not. Linux < 2.6.23 *silently* ignores O_CLOEXEC flag of open(). linux_version() is already implemented

[issue12105] open() does not able to set flags, such as O_CLOEXEC

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > test_socket: ...has a nice linux_version() which should be moved to > the platform module I created the issue #12158 for that. -- ___ Python tracker <http://bugs.python.org/i

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > The returned value should be a version string in a fixed format, > not a tuple. I'd suggest to use _norm_version() for this. How do you compare version strings? I prefer tuples, as sys.version_info, because the comparaison is more natural:

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Use "%s.%s.%s" % linux_version() if you would like to format the version. The format is well defined. (You should only do that under Linux.) -- ___ Python tracker <http://bugs.python.o

[issue12159] Integer Overflow in __len__

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: len(obj) is implemented using PyObject_Size() which is stores the result into a Py_ssize_t, and so is limited to sys.maxsize (2**31-1 or 2**63-1). This implementation detail should be documented. -- nosy: +haypo

[issue12028] threading._get_ident(): remove it in the doc or make it public

2011-05-23 Thread STINNER Victor
Changes by STINNER Victor : -- title: threading._get_ident(): remove it in the doc and make it public -> threading._get_ident(): remove it in the doc or make it public ___ Python tracker <http://bugs.python.org/issu

[issue8796] Deprecate codecs.open()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: deprecate_codecs.patch: "Deprecate open(), StreamReader, StreamWriter, StreamReaderWriter, StreamRecord and EncodedFile() of the codec module. Use the builtin open() function or io.TextIOWrapper instead." EncodedFile() and StreamRecord cannot b

[issue8796] Deprecate codecs.open(), codecs.StreamReader and codecs.StreamWriter

2011-05-23 Thread STINNER Victor
Changes by STINNER Victor : -- title: Deprecate codecs.open() -> Deprecate codecs.open(), codecs.StreamReader and codecs.StreamWriter ___ Python tracker <http://bugs.python.org/iss

[issue8796] Deprecate codecs.open(), codecs.StreamReader and codecs.StreamWriter

2011-05-23 Thread STINNER Victor
Changes by STINNER Victor : -- status: -> open ___ Python tracker <http://bugs.python.org/issue8796> ___ ___ Python-bugs-list mailing list Unsubscri

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > You can then use linux_version().split('.') in code that want > to do version comparisons. It doesn't give the expected result: >>> ('2', '6', '9') < ('2', '6', '

[issue12073] regrtest: use faulthandler to dump the tracebacks on SIGUSR1

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Thanks for your review, here is an updated patch. -- Added file: http://bugs.python.org/file22082/regrtest_sigusr1-3.patch ___ Python tracker <http://bugs.python.org/issue12

[issue12073] regrtest: use faulthandler to dump the tracebacks on SIGUSR1

2011-05-23 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file21995/regrtest_sigusr1.patch ___ Python tracker <http://bugs.python.org/issue12073> ___ ___ Python-bug

[issue12073] regrtest: use faulthandler to dump the tracebacks on SIGUSR1

2011-05-23 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file22067/regrtest_sigusr1-2.patch ___ Python tracker <http://bugs.python.org/issue12073> ___ ___ Pytho

[issue12073] regrtest: use faulthandler to dump the tracebacks on SIGUSR1

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Merwok's review: << Looks like a useful feature. http://bugs.python.org/review/12073/diff/2659/6441 File Lib/test/regrtest.py (right): http://bugs.python.org/review/12073/diff/2659/6441#newcode164 Lib/test/regrtest.py:164: You can send a SIGUSR

[issue12160] codecs doc: what is StreamCodec?

2011-05-23 Thread STINNER Victor
New submission from STINNER Victor : Codec.encode() and Codec.decode() refer to StreamCode, but I cannot find this class in the doc nor in the code. I suppose that it should be replaced by IncrementalEncoder and IncrementalDecoder. If I'm correct, see attached patch. --

<    9   10   11   12   13   14   15   16   17   18   >