[issue14583] try/except import fails --without-threads

2012-04-15 Thread Stefan Krah

Stefan Krah  added the comment:

The SystemError has changed to a KeyError:


http://www.python.org/dev/buildbot/all/builders/AMD64%20Fedora%20without%20threads%203.x/builds/2004/steps/test/logs/stdio


At least that makes it easy to spot the location in import.c. The
shortest way to reproduce the error is to compile --without-threads,
then:

import multiprocessing
import multiprocessing.process

--
priority: normal -> high

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14562] urllib2 maybe blocks too long with small chunks

2012-04-15 Thread Qiangning Hong

Changes by Qiangning Hong :


--
nosy: +hongqn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1508475] transparent gzip compression in urllib

2012-04-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The patch for py3k also has the disadvantage that the content is decoded even 
if the user has defined a Content-Encoding and he is going to process 
compressed response himself.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10854] Output .pyd name in error message of ImportError when DLL load fails

2012-04-15 Thread Brian Curtin

Changes by Brian Curtin :


--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10854] Output .pyd name in error message of ImportError when DLL load fails

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f341b99bb370 by Brian Curtin in branch 'default':
Fix #10854. Make use of the new path and name attributes on ImportError
http://hg.python.org/cpython/rev/f341b99bb370

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 4256df44023b by Brett Cannon in branch 'default':
Issue #13959: Re-implement imp.load_package() in imp.py.
http://hg.python.org/cpython/rev/4256df44023b

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14590] ConfigParser doesn't strip inline comment when delimiter occurs earlier without preceding space.

2012-04-15 Thread R. David Murray

Changes by R. David Murray :


--
versions:  -Python 2.6, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14590] ConfigParser doesn't strip inline comment when delimiter occurs earlier without preceding space.

2012-04-15 Thread R. David Murray

Changes by R. David Murray :


--
assignee:  -> lukasz.langa
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14590] ConfigParser doesn't strip inline comment when delimiter occurs earlier without preceding space.

2012-04-15 Thread Graham Dumpleton

New submission from Graham Dumpleton :

When parsing for inline comments, ConfigParser will only check the first 
occurrence of the delimiter in the line. If that instance of the delimiter 
isn't preceded with a space, it then assumes no comment. This ignores the fact 
that there could be a second instance of the delimiter which does have a 
preceding space. The result is that inline comments can be left as part of the 
value.

So, a config file of:

[section]
value1 = a;b
value2 = a ; comment
value3 = a; b ; comment

after parsing actually results in:

[section]
value1 = a;b
value2 = a
value3 = a; b ; comment

That is, 'value3' is incorrect as still embeds the inline comment.

Test script attached for Python 2.X.

Not tested on Python 3.X but code appears to do the same thing, except that on 
Python 3.X inline comments are disabled by default.

--
components: Library (Lib)
files: test_config.py
messages: 158397
nosy: grahamd
priority: normal
severity: normal
status: open
title: ConfigParser doesn't strip inline comment when delimiter occurs earlier 
without preceding space.
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file25233/test_config.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14589] test_algorithms() of test_ssl fails: certificate of sha256.tbs-internet.com changed

2012-04-15 Thread STINNER Victor

STINNER Victor  added the comment:

Thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6657] Copy documentation section

2012-04-15 Thread R. David Murray

R. David Murray  added the comment:

Hmm.  2.5 years later it isn't looking like we are going to get a response.  
Closing.

--
nosy: +r.david.murray
resolution:  -> works for me
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14589] test_algorithms() of test_ssl fails: certificate of sha256.tbs-internet.com changed

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Fixed!
Note: to get the new certificate chain, I just did:

$ openssl s_client -connect sha256.tbs-internet.com:443 -showcerts

:)

--
components: +Tests
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14589] test_algorithms() of test_ssl fails: certificate of sha256.tbs-internet.com changed

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 33bc53e0aa9e by Antoine Pitrou in branch '2.7':
Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing a 
test failure in test_ssl.
http://hg.python.org/cpython/rev/33bc53e0aa9e

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14589] test_algorithms() of test_ssl fails: certificate of sha256.tbs-internet.com changed

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f323b37ef6c1 by Antoine Pitrou in branch '3.2':
Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing a 
test failure in test_ssl.
http://hg.python.org/cpython/rev/f323b37ef6c1

New changeset 34f09c654a5b by Antoine Pitrou in branch 'default':
Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing a 
test failure in test_ssl.
http://hg.python.org/cpython/rev/34f09c654a5b

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10722] IDLE's subprocess didnit make connection ..... Python 2.7

2012-04-15 Thread Roger Serwy

Roger Serwy  added the comment:

The IDLE front-end doesn't receive anything about the subprocess failure mode. 
The "poll_subprocess" method in PyShell.py will restart the subprocess if the 
socket closes. (The "pollpacket" method in rpc.py raises an EOFError.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9949] os.path.realpath on Windows does not follow symbolic links

2012-04-15 Thread Daniel Harding

Daniel Harding  added the comment:

Uploading a new series of patches - they are all the same as the first set, 
except for 0006-Make-realpath-follow-symbolic-links-on-Windows.patch.  I 
realized that I could use os.readlink to handle broken symbolic links, so I 
changed the logic of os.path.realpath slightly to do that (including recursive 
symlink detection).

--
Added file: http://bugs.python.org/file25232/issue9949-v2.tar.bz2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10722] IDLE's subprocess didnit make connection ..... Python 2.7

2012-04-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

3.2.3 and 2.7.3 are out. And I am running on win7 without problems.
I have not tried running multiple shells of the same Python version, but I have 
occasionally run 2.7 and 3.2 simultaneously without problems that I noticed.

Roger, does IDLE get any info at all from the subprocess failure that it could 
display?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14586] TypeError: truncate() takes no keyword arguments

2012-04-15 Thread R. David Murray

R. David Murray  added the comment:

The suggested doc change won't work, since that would imply that the size 
argument was required.  We'd have to use the old truncate([size]) notation.

Supporting it as a keyword argument is probably to be preferred, but someone 
will have to write the patch :)

--
nosy: +pitrou, r.david.murray
stage:  -> needs patch
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14576] IDLE cannot connect to subprocess - New solution

2012-04-15 Thread R. David Murray

R. David Murray  added the comment:

It certainly is worthwhile pursing this in some fashion, since at the very 
least the existing error message needs to be improved.  But perhaps there is 
something more that can be done to gracefully handle this case, instead.  I 
think the next interesting question is to find out why an invalid home 
directory causes idle to not start up.  There's no obvious reason why that 
should be the case in principle, so I suspect there's some error handling 
missing somewhere.

This probably also applies to 2.7; someone should test that.

--
nosy: +r.david.murray
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14589] test_algorithms() of test_ssl fails: certificate of sha256.tbs-internet.com changed

2012-04-15 Thread STINNER Victor

New submission from STINNER Victor :

http://www.python.org/dev/buildbot/all/builders/AMD64%20Gentoo%20Wide%203.x/builds/3677/steps/test/logs/stdio
==
ERROR: test_algorithms (test.test_ssl.NetworkedTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_ssl.py", 
line 841, in test_algorithms
s.connect(remote)
  File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/ssl.py", 
line 543, in connect
self._real_connect(addr, False)
  File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/ssl.py", 
line 533, in _real_connect
self.do_handshake()
  File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/ssl.py", 
line 513, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:435: error:14090086:SSL 
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

--

It looks like https://sha256.tbs-internet.com/ certificate changed: the serial 
number of the current certificate is 
00:AA:55:98:78:20:F6:77:C2:A1:D0:15:C1:C3:F8:B2:2C.

The serial number of Lib/test/sha256.pem is 
c9:9a:83:ec:a0:48:07:71:66:c6:f2:cd:88:e1:b9:6d (try "openssl x509 -in 
Lib/test/sha256.pem  -text -noout" command).

I don't know how to download the new certificate.

--
messages: 158386
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: test_algorithms() of test_ssl fails: certificate of 
sha256.tbs-internet.com changed
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10722] IDLE's subprocess didnit make connection ..... Python 2.7

2012-04-15 Thread Roger Serwy

Changes by Roger Serwy :


--
nosy: +serwy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8820] IDLE not launching correctly

2012-04-15 Thread Roger Serwy

Roger Serwy  added the comment:

Thank you for your feedback. I will close this issue since it is now out of 
date.

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8820] IDLE not launching correctly

2012-04-15 Thread Joseph

Joseph  added the comment:

Seems to work fine for me, operating system still Windows 64 bit, Python
2.7.2, IDLE 2.7.2

On Sat, Apr 14, 2012 at 6:08 PM, Roger Serwy  wrote:

>
> Roger Serwy  added the comment:
>
> Joseph, Jeff,
>
> Is this still a valid issue with the latest release of IDLE?
>
> --
> status: open -> pending
> type:  -> behavior
>
> ___
> Python tracker 
> 
> ___
>

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 2df37938b8e1 by Brett Cannon in branch 'default':
Issue #13959: Re-implement imp.load_module() in imp.py.
http://hg.python.org/cpython/rev/2df37938b8e1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14588] PEP 3115 compliant dynamic class creation

2012-04-15 Thread Daniel Urban

New submission from Daniel Urban :

As Nick Coghlan proposed [1, 2], there should be a way to dynamically create 
classes, which handles metaclasses correctly (see also issue1294232).

Here is my first attempt at creating an operator.build_class method. It only 
includes very simple tests and no documentation, but I will write them if 
needed.

With this patch there are two functions for creating a class object:
1. __build_class__ (no change)
2. operator.build_class(name, bases=(), kwds=None, eval_body=None): finds the 
correct metaclass and calls its __prepare__. If eval_body is given, calls it 
with the namespace returned by __prepare__. Then calls the correct metaclass, 
and returns the created class object.

Both of these functions (after parsing their arguments) call 
_PyType_BuildClass, a new C API function. The first argument of this function 
is a callable, that will be called with the namespace returned by __prepare__ 
(it also can be NULL, in that case nothing will be called). __build_class__ 
passes the function that is the body of the class statement. 
operator.build_class passes the callable given by the user (or NULL, if the 
user didn't pass the eval_body argument). The implementation of 
_PyType_BuildClass is approximately the following:

def _PyType_BuildClass(func=None, name, bases, kwds={}):
meta = kwds.pop('metaclass', None)
if meta is None:
if not bases:
meta = type
else:
meta = type(bases[0])
ns, meta = prepare_namespace(name, meta, bases, kwds)
if func is not None:
func(ns)
return meta(name, bases, ns, kwds)

(Actually the return value of the func is used if it's a cell object. I'm not 
sure, why and when this is needed, this code comes from __build_class__.)

The changes are in the following files:

1. object.h: the exported function is _PyType_BuildClass instead of 
_PyType_CalculateMetaclass (that doesn't need to be in the include file 
anymore).

2. operator.c: the build_class method checks its arguments, then calls 
_PyType_BuildClass.

3. typeobject.c:

_PyType_CalculateMetaclass is renamed to calculate_metaclass, because now it is 
only called from this file.

prepare_namespace calls calculate_metaclass to determine the correct metaclass, 
then calls its __prepare__ method. (This code is moved here mostly from 
__build_class__). It also passes back the correct metaclass to its caller.

_PyType_BuildClass gets the starting metaclass from its arguments. Then it 
calls prepare_namespace to get the namespace and the correct metaclass. If it 
received a non-NULL first argument (the function that is the class body or the 
eval_body argument of operator.build_class), then calls it, passing the 
namespace. Then it calls the correct metaclass. (Most of this code is also from 
__build_class__.)

4. bltinmodule.c: builtin___build_class__ now only parses its arguments, and 
simply calls _PyType_BuildClass.

5. test_operator.py: a simple test for operator.build_class


[1] http://mail.python.org/pipermail/python-dev/2011-April/110874.html
[2] http://mail.python.org/pipermail/python-dev/2012-April/118732.html

--
components: Extension Modules, Interpreter Core
files: operator_build_class.patch
keywords: patch
messages: 158382
nosy: durban, ncoghlan
priority: normal
severity: normal
status: open
title: PEP 3115 compliant dynamic class creation
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25231/operator_build_class.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13072] Getting a buffer from a Unicode array uses invalid format

2012-04-15 Thread STINNER Victor

STINNER Victor  added the comment:

@Stefan: What is the status of this issue?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9403] cElementTree: replace PyObject_DEL() by Py_DECREF() to fix a crash in pydebug mode

2012-04-15 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14385] Support other types than dict for __builtins__

2012-04-15 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1508475] transparent gzip compression in urllib

2012-04-15 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

In that case, transparent decompression should not be available. (
Request header should not be sent and response wont be compressed).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14385] Support other types than dict for __builtins__

2012-04-15 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file25132/builtins-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14385] Support other types than dict for __builtins__

2012-04-15 Thread STINNER Victor

STINNER Victor  added the comment:

Oops, patch version 2 was not correct: I forgot a { ... } in ceval.c.

New patch fixing this issue but leaves also the LOAD_GLOBAL code unchanged : 
keep the goto and don't try to factorize the 3 last instructions. LOAD_GLOBAL 
is really critical in performance.

With patch version 3, the overall overhead is +0.4% according to pybench.

--
Added file: http://bugs.python.org/file25230/builtins-3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2012-04-15 Thread Alex Leach

Alex Leach  added the comment:

Submitting a working patch upstream would make sense.. Just found, downloaded 
and tried compiling libffi-3.0.11. The developers have made some changes 
towards a solution, but compilation fails with the same error:-

libtool: compile:  icc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude 
-I../src -DFFI_BUILDING -g -O3 -ansi_alias -Wall -fexceptions -MT 
src/x86/ffi64.lo -MD -MP -MF src/x86/.deps/ffi64.Tpo -c ../src/x86/ffi64.c  
-fPIC -DPIC -o src/x86/.libs/ffi64.o
../src/x86/ffi64.c(50): error: identifier "__m128" is undefined
UINT128 sse[MAX_SSE_REGS];


__m128 is defined in Intel's xmmintrin.h though 
[http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/cpp/lin/compiler_c/intref_cls/common/intref_sse_arithmetic.htm].

So I added the necessary include line, which gets a different error:-

libtool: compile:  icc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude 
-I../src -DFFI_BUILDING -g -O3 -ansi_alias -Wall -fexceptions -MT 
src/x86/ffi64.lo -MD -MP -MF src/x86/.deps/ffi64.Tpo -c ../src/x86/ffi64.c  
-fPIC -DPIC -o src/x86/.libs/ffi64.o
../src/x86/ffi64.c(481): error: a value of type "UINT64={unsigned long}" cannot 
be assigned to an entity of type "__m128"
  reg_args->sse[ssecount++] = *(UINT64 *) a;
^

../src/x86/ffi64.c(484): error: a value of type "UINT32={unsigned int}" cannot 
be assigned to an entity of type "__m128"
  reg_args->sse[ssecount++] = *(UINT32 *) a;
^

Regarding my previous patch, I'm not convinced it works actually.. It compiles, 
and passes the default Python tests, but I get some dodgy behaviour. e.g. when 
compiling 2.7.3 with --enable-shared, I get a segfault when compiling the gdbm 
module against libdb4.8-dev. Any specific ways of testing the build?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Brett Cannon

Brett Cannon  added the comment:

I am seeing how this is going to go down. the load_dynamic, load_source, etc. 
family of functions are simply dispatched to by load_module(). So to keep some 
semblance of backwards-compatibility, each of those modules need to be 
implemented and then have load_module() simply dispatch to them based on the 
"type" of module it is.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14385] Support other types than dict for __builtins__

2012-04-15 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24989/builtins.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2012-04-15 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

https://github.com/atgreen/libffi/blob/master/src/x86/ffi64.c contains:

#ifdef __INTEL_COMPILER
#define UINT128 __m128
#else
#define UINT128 __int128_t
#endif

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14386] Expose dict_proxy internal type as types.MappingProxyType

2012-04-15 Thread STINNER Victor

STINNER Victor  added the comment:

> Summary:  The collections.abc module is fine as-is.

Ok, but there is still an issue: issubclass(types.MappingProxyType, 
collections.abc.Mapping) is False. Attached registers MappingProxyType as a 
Mapping. Is it correct?

The patch also renames dict_proxy to mappingproxy. Is it backward incompatible? 
(collections.abc module was added to Python 3.3)

--
Added file: http://bugs.python.org/file25229/mappingproxy_abc.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14386] Expose dict_proxy internal type as types.MappingProxyType

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c3a0197256ee by Victor Stinner in branch 'default':
Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType
http://hg.python.org/cpython/rev/c3a0197256ee

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2012-04-15 Thread Meador Inge

Meador Inge  added the comment:

> I suggest to not apply additional patches for Modules/_ctypes/libffi* 
> due to issue #12081. Patches for libffi should be sent to libffi 
> upstream.

For trunk I agree.  However, it is probably worth considering this patch
for 2.7 and 3.2.

Did anyone check to see if this is already fixed in upstream libffi?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14304] Implement utf-8-bmp codec

2012-04-15 Thread STINNER Victor

STINNER Victor  added the comment:

What is this codec? What do you mean by "escpe non-ascii"?

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14579] Possible vulnerability in the utf-16 decoder after error handling

2012-04-15 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 4dce3afc392c by Brett Cannon in branch 'default':
Issue #13959: Simplify imp.reload() by relying on a module's
http://hg.python.org/cpython/rev/4dce3afc392c

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Brett Cannon

Brett Cannon  added the comment:

It looks like in order to get a clear sign of what it will take to remove 
various parts of import.c, imp.load_module() needs to go along with 
imp.load_package() (since they call each other in the C code). You also have to 
take care of imp.reload(), but I am simplifying the C code greatly and will 
take care of referencing other code in the module.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8900] IDLE crashes if Preference set to At Startup -> Open Edit Window

2012-04-15 Thread Roger Serwy

Roger Serwy  added the comment:

Thanks for your review, Terry.

Popping from the end is not an implementation of rule 2. Calling event handlers 
is separate concept from binding/unbinding event handlers. The "doafterhandler" 
list contains bind/unbind requests that were made while calling event handlers. 
The doafterhandler "queue" should be FIFO, not LIFO.

Code note 1:

The running time of the algorithm is an important consideration. Your last 
suggestion for using a for-loop looks most appropriate, as you've said. 
Attached is a revised patch for it.

Code note 2:

The _ComplexBinder class may need refactoring, but that's a separate issue. I'm 
willing to review patches for that.

--
Added file: http://bugs.python.org/file25228/issue8900_rev1.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12387] IDLE save keyboard shortcut problem

2012-04-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Changes look complete and correct as far as I can tell, except that I have some 
confusion about the relation of Shift and CapsLock key. For instance, Control-C 
and Control-Shift-C (using the key labels) both interrupt a loop whether or not 
CapsLock is on. In all, 4 combinations work even though only 2 are listed.
 interrupt-execution= 

However, this pair of specifications
+save-window-as-file= 
+save-window= 
only makes sense to me if 's' and 'S' refer to the 'S' key without and with 
CapLock on as using Shift is meant to give a different meaning. It appears to 
split the 4 combinations into 2 pairs that do different things.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14576] IDLE cannot connect to subprocess - New solution

2012-04-15 Thread clikkeb

clikkeb  added the comment:

Thanks for your answer.

Trying to understand how IDLE uses HOMEPATH and USERPROFILE Windows
variables, I have found the following information:
1) it seems that when executed via Windows command prompt (cmd.exe),
   os.path.expanduser refers to USERPROFILE to determine the user's
   home directory;
2) analizing the stack traces of the first calls to
   IdleConf.GetUserCfgDir, you can see that GetUserCfgDir (which
   calls expanduser) is called three times during IDLE startup:
   the first two times it refers to USERPROFILE, the third (called
   via run.py, probably after starting a subprocess) it refers to
   the combination of HOMEDRIVE and HOMEPATH. (???)
3) when you start IDLE using pythonw, sys.stderr.write(warn) seems
   to raise an AttributeError exception, which is unhandled. This
   causes IDLE to stop running when you either start IDLE that way
   and the user's home directory is unreachable.

Due to the Python's tricky behaviour in determining the Windows
user's home directory, my opinion would be to consider if it is
worth to go further with this discussion or if it could produce
a benefit to IDLE. For sure, it gave me a little bit of headache.

clikkeb.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14339] Optimizing bin, oct and hex

2012-04-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> (1) The patch appears to assume that a Unicode string created with 
> PyUnicode_New(size, 127) will have 'kind' PyUnicode_1BYTE_KIND.  While this 
> might be true in the current implementation, I don't know whether this is 
> guaranteed in general.  Martin, any comments on this?

The same assumption is used above in long_to_decimal_string(). I added
the same assert and changed maxchar to 'f'.

> (2) The patch doesn't compile with '--with-pydebug':  there's a reference to 
> the (now) undefined variable 'buffer' in one of the asserts.

Fixed.

> (3) The overflow check looks as though it needs to be reworked.

I was left an old constraint (it is enough), but it really can be
weakened (in fact, it can be so weakened in the current code).

Thank you for the comments and the found error.

--
Added file: http://bugs.python.org/file25227/long_to_binary_base_2.patch

___
Python tracker 

___diff -r 13307eb5bf47 Objects/longobject.c
--- a/Objects/longobject.c  Sat Apr 14 14:20:29 2012 -0500
+++ b/Objects/longobject.c  Sun Apr 15 23:29:34 2012 +0300
@@ -1672,11 +1672,10 @@
 {
 register PyLongObject *a = (PyLongObject *)aa;
 PyObject *v;
-Py_ssize_t i, sz;
+Py_ssize_t sz;
 Py_ssize_t size_a;
-char *p;
-char sign = '\0';
-char *buffer;
+Py_UCS1 *p;
+int negative;
 int bits;
 
 assert(base == 2 || base == 8 || base == 10 || base == 16);
@@ -1688,6 +1687,7 @@
 return NULL;
 }
 size_a = ABS(Py_SIZE(a));
+negative = Py_SIZE(a) < 0;
 
 /* Compute a rough upper bound for the length of the string */
 switch (base) {
@@ -1706,31 +1706,37 @@
 }
 /* compute length of output string: allow 2 characters for prefix and
1 for possible '-' sign. */
-if (size_a > (PY_SSIZE_T_MAX - 3) / PyLong_SHIFT / sizeof(Py_UCS4)) {
+if (size_a > (PY_SSIZE_T_MAX - 3) / PyLong_SHIFT) {
 PyErr_SetString(PyExc_OverflowError,
 "int is too large to format");
 return NULL;
 }
 /* now size_a * PyLong_SHIFT + 3 <= PY_SSIZE_T_MAX, so the RHS below
is safe from overflow */
-sz = 3 + (size_a * PyLong_SHIFT + (bits - 1)) / bits;
-assert(sz >= 0);
-buffer = PyMem_Malloc(sz);
-if (buffer == NULL) {
+if (size_a == 0) {
+sz = 3;
+}
+else {
+sz = 2 + negative + ((size_a - 1) * PyLong_SHIFT +
+ bits_in_digit(a->ob_digit[size_a - 1]) +
+ (bits - 1)) / bits;
+}
+v = PyUnicode_New(sz, 'f');
+if (v == NULL) {
 PyErr_NoMemory();
 return NULL;
 }
-p = &buffer[sz];
-if (Py_SIZE(a) < 0)
-sign = '-';
-
-if (Py_SIZE(a) == 0) {
+assert(PyUnicode_KIND(v) == PyUnicode_1BYTE_KIND);
+p = PyUnicode_1BYTE_DATA(v) + sz;
+
+if (size_a == 0) {
 *--p = '0';
 }
 else {
 /* JRH: special case for power-of-2 bases */
 twodigits accum = 0;
 int accumbits = 0;  /* # of bits in accum */
+Py_ssize_t i;
 for (i = 0; i < size_a; ++i) {
 accum |= (twodigits)a->ob_digit[i] << accumbits;
 accumbits += PyLong_SHIFT;
@@ -1739,7 +1745,7 @@
 char cdigit;
 cdigit = (char)(accum & (base - 1));
 cdigit += (cdigit < 10) ? '0' : 'a'-10;
-assert(p > buffer);
+assert(p > PyUnicode_1BYTE_DATA(v));
 *--p = cdigit;
 accumbits -= bits;
 accum >>= bits;
@@ -1747,6 +1753,7 @@
 }
 }
 
+assert(p == PyUnicode_1BYTE_DATA(v) + 2 + negative);
 if (base == 16)
 *--p = 'x';
 else if (base == 8)
@@ -1754,10 +1761,8 @@
 else /* (base == 2) */
 *--p = 'b';
 *--p = '0';
-if (sign)
-*--p = sign;
-v = PyUnicode_DecodeASCII(p, &buffer[sz] - p, NULL);
-PyMem_Free(buffer);
+if (negative)
+*--p = '-';
 return v;
 }
 
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Brett Cannon

Brett Cannon  added the comment:

OK, so I have started to check this stuff in, but I think it's best to do it 
piecemeal. Going forward I would like to commit in units of functions being 
replaced, and prioritize stuff that cuts out C code (e.g. the load_*() methods, 
find_module(), etc.). That way it's clear that progress is being made. 
Obviously the best way to tell if code is hanging on just because of imp is to 
comment out the interface code and see what your compiler complains about in 
terms of dead code (or at least clang is good at this).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d777f854a66e by Brett Cannon in branch 'default':
Issue #13959: Rename imp to _imp and add Lib/imp.py and begin
http://hg.python.org/cpython/rev/d777f854a66e

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8900] IDLE crashes if Preference set to At Startup -> Open Edit Window

2012-04-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

With 3.2.3, after selecting open edit on startup and using ^O to select a file, 
I got a silent close of the editor window. Opening from the file menu worked. 
After the change of adding '0', ^O worked also.

However, without a test suite, I am a little nervous about the change, as the 
original code might be intentional. From the module doc string:

"The order by which events are called is defined by these rules:
1. A more-specific event will be called before a less-specific event.
2. A recently-binded event will be called before a previously-binded event, 
unless this conflicts with the first rule."

Is popping from the end the implementation of rule 2?
Is it possible that one event pair is being appended in the wrong order?
I need to read more of the comments and code to understand this subsystem.


Code note 1: doafterhandler = self.doafterhandler (initially [] by default), so 
changes to the list must be mutations to affect the self attribute.

while doafterhandler:
doafterhandler.pop(0)()
# is O(n*2)

doafterhandler.reverse()
while doafterhandler:
  doafterhandler.pop()()
# is O(n)

for f in doafterhandler:
f()
doafterhandler[:] = []
# doafterhandler.clear() works in 3.3
# is also O(n) and replaces repeated .pop with one clear

If calling first to last is proper, I prefer this last unless the callback 
functions somehow require that they be removed from doafterhandler before being 
called.


Code note 2: unless the default args for handler

def __create_handler(self, lists, mc_type, mc_state):
def handler(event, lists = lists,
mc_type = mc_type, mc_state = mc_state,
ishandlerrunning = self.ishandlerrunning,
doafterhandler = self.doafterhandler):

are ever replaced with other arguments in handler(event) calls, their presence 
in the signature would appear to be holdovers from before closures. If so, the 
above could be simplified to
def handler(event)
and 'self.' added in the body where needed.

I also wonder whether the double underscore and consequent name mangling for 
__create_handler is needed. My understanding is that this is only needed, 
perhaps, for multiple inheritance mixin classes, and I do not see that class 
_ComplexBinder qualifies.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13959] Re-implement parts of imp in pure Python

2012-04-15 Thread Brett Cannon

Brett Cannon  added the comment:

Just because I was thinking about it, I wonder if necessarily all the frozen 
stuff really needs to stay in import.c. I mean a frozen module is really just 
an entry in an array of structs that has a name of an char*[]. I don't see why 
one couldn't simply have a get_frozen_bytes() method to convert that char*[] 
into a bytes object and use that to construct a module in pure Python code.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

> There are other crashers we choose to ignore (involving gc.getreferrers, > 
> bytecode hacks, ctypes, etc).  I think this should go in that category
> and I would be happy to add a note to that effect in the docs for tertools.

Yes, including my previous example with repr()
a = None
for i in range(10):
a = {1: a}
repr(a)

This is a case where care has been taken for lists, tuples, but not dicts.  If 
we want to fix repr, the recursion checking shoudl probably go into 
PyObject_repr().  I'm not advocating for a fix, Just pointing out yet another 
way you can construct objects so that accessnig them will cause a crash.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

> (A static expression with even 100 nested calls fails compilation with a > 
> MemoryError (3.2.3).)

I don't think that's at all related to this issue:  that has to do with the 
fixed-size parser stack used when parsing Python code (see MAXSTACK in 
Parser/parser.h).  Nothing to do with the C stack. :-)

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

ISTM this would do more harm than good.  An introduce a new requirement for all 
iterators, introducing new arbitrary limits and slowing down all iterators 
(this is currently a simple, fast, light-weight protocol). 

Also this seems to be just a CPython issue (the JVM manages its own stack).   
Please don't muck-up the iterator protocol over this non-issue.  It isn't worth 
it.  If someone wants a stackless version of Python, they should use a 
stackless version of Python.

There are other crashers we choose to ignore (involving gc.getreferrers, 
bytecode hacks, ctypes, etc).  I think this should go in that category and I 
would be happy to add a note to that effect in the docs for itertools.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11750] Mutualize win32 functions

2012-04-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

>at some point it became the Windows API.
You are right: http://en.wikipedia.org/wiki/Windows_API
How about _windowsapi or _winapi then, to ensure there are no clashes?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14582] Have importlib use return value from a loader's load_module()

2012-04-15 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> fixed
stage: test needed -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

On the other hand, Antoine is correct in that we _could_ use the existing 
infrastructure and count PyIter_Next() as a recursion in the same way as 
entering the ceval loop is a recursion.  Extra checking in there would hardly 
slow down the execution much.  (but it would have to do its job only when 
invoking a "c" implemented iternext routine...)

I tried to come up with other ways that we could create deeply nested C 
function calls...
Here's one:
...
a = (a, a)
b = (b, b)
a < b

This however gets caught by this code:
if (Py_EnterRecursiveCall(" in comparison"))
return NULL;
res = do_richcompare(v, w, op);
Py_LeaveRecursiveCall();

So obviously someone thought this could be an issue.

However:
...
 a = {1: a}
repr(a)

will generate the same crash. (tuple repr and list repr have guards, dict repr 
not)

So, there are various ways to get c recursion to overflow the C stack.  Some of 
them have been patched throughout the years, others not.

We could try to identify all the different ways.  We could for example add 
guards in PyObject_Repr() rather than individual types.  But I'm sure we will 
leave holes in place like the OP discovered with deeply nested iterators.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14582] Have importlib use return value from a loader's load_module()

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 005fd1fe31ab by Brett Cannon in branch 'default':
Issue #14582: Import returns the module returned by a loader instead
http://hg.python.org/cpython/rev/005fd1fe31ab

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2012-04-15 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

I suggest to not apply additional patches for Modules/_ctypes/libffi* due to 
issue #12081. Patches for libffi should be sent to libffi upstream.

--
nosy: +Arfrever

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2012-04-15 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12387] IDLE save keyboard shortcut problem

2012-04-15 Thread Roger Serwy

Changes by Roger Serwy :


--
stage:  -> patch review
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12387] IDLE save keyboard shortcut problem

2012-04-15 Thread Roger Serwy

Roger Serwy  added the comment:

Attached is a patch to fix the caps-lock issue with Windows key bindings in 
config-keys.def.

--
keywords: +patch
Added file: http://bugs.python.org/file25226/windows_caps_lock.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9949] os.path.realpath on Windows does not follow symbolic links

2012-04-15 Thread Daniel Harding

Daniel Harding  added the comment:

I have attached a series of patches with (hopefully) provide more robust fix 
for this issue, against the Python 3.3 branch.  It handles both bytes and str 
objects, paths that do not actually exist on the filesystem, and removal of the 
'\\?\' prefix returned by _getfinalpathname, unless the supplied path had that 
prefix already.  A couple of the patches contain some separate infrastructure 
that could hopefully be used to simplify some of the other Windows code in 
posixmodule.c (One immediate possibility would be to combine the code provided 
in these patches with the symbolic-link resolution code in the Windows stat 
functions - there is quite a bit of duplication there that could be eliminated.)

One thing these patches do not address is resolving a broken symbolic link.  
The Windows API function GetFinalPathNameByHandle does not handle this case 
(because CreateFile cannot be used to get a handle if the symbolic link is 
broken).  This functionality could be implemented by manually following the 
reparse points, but that would basically require reimplementing 
GetFinalPathNameByHandle.

Finally, this patch could be fairly easily backported to Python 3.2, but that 
shouldn't be done without careful consideration.  It changes the return value 
from os.path.realpath on Windows even when there are no symbolic links in the 
path (the returned value will have the actual casing as stored on the 
filesystem, instead of the casing supplied by the user).  I don't think it 
should be backported to Python 2.7, because that version, like all Python 
versions before Python 3.2 are unaware of symbolic links on Windows (e.g. 
lexists is the same function as exists).

The patches were generated using git (I use git-hg) - if that format is a 
problem, let me know and I can regenerate them.

--
nosy: +dharding
Added file: http://bugs.python.org/file25225/issue9949.tar.bz2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> It happens to be that recursive calls are the easiest way to do that,
> but Python makes it somewhat easy to dynamically generate thousands of
> different callables making thousands of non-recursive nested calls.

That's a rather pointless discussion of terminology, IMHO.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14339] Optimizing bin, oct and hex

2012-04-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

A few comments:

(1) The patch appears to assume that a Unicode string created with 
PyUnicode_New(size, 127) will have 'kind' PyUnicode_1BYTE_KIND.  While this 
might be true in the current implementation, I don't know whether this is 
guaranteed in general.  Martin, any comments on this?

(2) The patch doesn't compile with '--with-pydebug':  there's a reference to 
the (now) undefined variable 'buffer' in one of the asserts.

(3) The overflow check looks as though it needs to be reworked.

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

[Raymond: I presume you meant that C iterators have not been a problem in the 
wild and have done fine.]

The RuntimeError message "maximum recursion depth exceeded" is not exactly 
correct. As Kristján implied in his first message, what has been reached is the 
maximum call stack or nested call depth. It happens to be that recursive calls 
are the easiest way to do that, but Python makes it somewhat easy to 
dynamically generate thousands of different callables making thousands of 
non-recursive nested calls. (A static expression with even 100 nested calls 
fails compilation with a MemoryError (3.2.3).)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11750] Mutualize win32 functions

2012-04-15 Thread Brian Curtin

Brian Curtin  added the comment:

pythoncore.vcproj)
> > * no changes to pcbuild.sln needed
> > * removed reference to 'win32_functions.c' in setup.py
>
> I think the module would be better named _win32, since that's the name
> of the API (like POSIX under Unix).

While there are many references to it being called Win32 API around the
web, at some point it became the Windows API.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8900] IDLE crashes if Preference set to At Startup -> Open Edit Window

2012-04-15 Thread Roger Serwy

Roger Serwy  added the comment:

Implicit relative imports are not related to this issue. 

Can someone please review the given patch?

--
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14585] Have test_import run more importlib tests

2012-04-15 Thread Brett Cannon

Brett Cannon  added the comment:

This also means that the importlib.test.import_.util.importlib_only decorators 
are probably all useless.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14587] Certain diacritical marks can and should be capitalized... e.g. ü --> Ü

2012-04-15 Thread R. David Murray

R. David Murray  added the comment:

Indeed, this type of confusion is a large part of the motivation behind Python3.

You might try posting to the python-list mailing list asking for help if for 
some reason you are required to use python2 for your program.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11750] Mutualize win32 functions

2012-04-15 Thread sbt

sbt  added the comment:

> I think the module would be better named _win32, since that's the name
> of the API (like POSIX under Unix).

Changed in new patch.

> Also, it seems there are a couple of naming inconsistencies renaming
> (e.g. the overlapped wrapper is named "_multiprocessing.win32.Overlapped")

I've fixed that one (and changed the initial comment at the beginning of 
_win32.c), but I can't see any other.

I also removed a duplicate of getulong().

--
Added file: http://bugs.python.org/file25224/win32_module.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14587] Certain diacritical marks can and should be capitalized... e.g. ü --> Ü

2012-04-15 Thread STINNER Victor

STINNER Victor  added the comment:

Or you can port your program to Python 3 to avoid such issues :-)

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> The existing sys.max_recursion_depth was put in as a defense against
> the relatively common mistake of users writing a recursive function
> and getting the termination code wrong.   I don't think that logic
> would apply to intentionally deeply nested data structures or
> iterators.

Well, we have a history of trying to fix crashers, even when they only
occur in weird cases.

> Stackoverflows in C are hard to protect against.

We could simply re-use the existing infrastructure.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

[Kristján]
> a = map(add, a, b) also crashes this.
> ...  What's happening here is just simple c recursion 
> trough function pointers, ending in stack overflow, ...

Thanks for the analysis.  ISTM, this bug report is getting less and less 
interesting (or at least, less actionable without heavy-handed interventions in 
multiple tools).

One other thought, the OPs isn't really recursive in the sense of a function 
calling itself repeatedly.  Instead, the OPs explicitly creates a heavily 
nested pile of distinct iterator objects and then runs the entire chain.  This 
isn't much different from someone writing:  os.system('cat somefile | ' + ' | 
'.join(['sort']*10)).

The existing sys.max_recursion_depth was put in as a defense against the 
relatively common mistake of users writing a recursive function and getting the 
termination code wrong.   I don't think that logic would apply to intentionally 
deeply nested data structures or iterators.

Stackoverflows in C are hard to protect against.  We could take every iterator 
and set some limits on it, but that would be heavy handed and likely do more 
harm than good (C iterators have been around almost a decade and haven't done 
fine in the wild.  The itertools in particular were designed to gain speed 
through by-passing the eval-loop.  Slowing them down would be counter to their 
primary use case.)

--
resolution:  -> later

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2012-04-15 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8212] A tp_dealloc of a subclassed class cannot resurrect an object

2012-04-15 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Mark Dickinson

Changes by Mark Dickinson :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14587] Certain diacritical marks can and should be capitalized... e.g. ü --> Ü

2012-04-15 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

In addition to R. David's remark, it also works fine in a German locale. In 
general, you cannot know whether the byte '\xe4' denotes 'ä' or some other 
letter. For example, in KOI8-R, it denotes Д, instead, which already is an 
upper-case letter. So either do setlocale at the start of your program, or 
(better) switch to Unicode strings.

Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'ä'.upper()
Ä

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13496] bisect module: Overflow at index computation

2012-04-15 Thread Mark Dickinson

Changes by Mark Dickinson :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13496] bisect module: Overflow at index computation

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 35a3a7e0d66d by Mark Dickinson in branch '3.2':
Issue 13496: Fix bisect.bisect overflow bug for large collections.
http://hg.python.org/cpython/rev/35a3a7e0d66d

New changeset 1a9252280f07 by Mark Dickinson in branch 'default':
Issue #13496: Merge from 3.2
http://hg.python.org/cpython/rev/1a9252280f07

New changeset 709af2d0e862 by Mark Dickinson in branch '2.7':
Issue 13496: Fix bisect.bisect overflow bug for large collections.
http://hg.python.org/cpython/rev/709af2d0e862

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14587] Certain diacritical marks can and should be capitalized... e.g. ü --> Ü

2012-04-15 Thread Christian Clauss

Christian Clauss  added the comment:

On Apr 15, 2012, at 4:43 PM, R. David Murray wrote:

> 
> R. David Murray  added the comment:
> 
> It works fine if you use unicode.
> 
> --
> nosy: +r.david.murray
> resolution:  -> invalid
> stage:  -> committed/rejected
> status: open -> closed
> 
> ___
> Python tracker 
> 
> ___

What does it mean in this context to "use unicode"??
===
In Idle... 
===
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> lusai = u'lüsai'
Unsupported characters in input
>>> lusai = 'lüsai'
Unsupported characters in input
>>> print "ŠČŽ"
Unsupported characters in input
===
In a script...
Every time that I try to "use unicode" an exception is thrown.
  All try blocks in the following code trigger an exception
===
#/bin/bash/env python
# -*- coding: utf-8 -*-

print '=='

import sys # sys.version_info = sys.version_info(major=2, minor=7, micro=1, 
releaselevel='final', serial=0)
print 'sys.version_info = {}.{}.{} {} {}'.format(sys.version_info[0], 
sys.version_info[1], sys.version_info[2], sys.version_info[3], 
sys.version_info[4])

import commands, os
print 'os.name = {}'.format(os.name)
print 'os.uname = {}'.format(os.uname())

print '=='

def myUpper(inString):
return inString.upper().replace('à', 'À').replace('ä', 'Ä').replace('è', 
'È').replace('é', 'É').replace('ö', 'Ö').replace('ü', 'Ü').replace('ẞ', 'ß')

def myLower(inString):
return inString.lower().replace('À', 'à').replace('Ä', 'ä').replace('È', 
'è').replace('É', 'é').replace('Ö', 'ö').replace('Ü', 'ü').replace('ß', 'ẞ')

def myTitle(inString):
returnValue = []
for theWord in inString.split():
returnValue.append(myUpper(theWord[:1]) + myLower(theWord[1:]))
return ' '.join(returnValue)

def formatted(inValue, inSep = ' '):
s = str(inValue)
print ' s={}{}su={}{}sl={}{}st={}...'.format(s, inSep, s.upper(), inSep, 
s.lower(), inSep, s.title())
print ' s={}{}mu={}{}ml={}{}mt={}...'.format(s, inSep, myUpper(s), inSep, 
myLower(s), inSep, myTitle(s))
u = unicode(inValue, 'utf8')
try:
print ' u={}{}uu={}{}ul={}{}ut={}...'.format(u, inSep, u.upper(), 
inSep, u.lower(), inSep, u.title())
except:
print "=== Exception thrown trying to print unicode({}, 
'utf8')".format(repr(s))

kolnUpperUnspecified   = str('KÖLN')
kolnUpperAsString  = str('KÖLN')
kolnUpperAsUnicode = unicode('KÖLN', 'utf8')

kolnLowerUnspecified   = str('köln')
kolnLowerAsString  = str('köln')
kolnLowerAsUnicode = unicode('köln', 'utf8')

formatted(kolnUpperUnspecified)
formatted(kolnUpperAsString)
try:
formatted(kolnUpperAsUnicode)
except:
pass

formatted(kolnLowerUnspecified)
formatted(kolnLowerAsString)
try:
formatted(kolnLowerAsUnicode)
except:
pass

formatted('Ötto Clauß lives in the hamlet of Lüsai in the village of Lü in the 
valley of Val Müstair in the Canton of Graubünden', '\n')
formatted('ZÜRICH is the largest city in Switzerland and the geographic center 
of the country is in Älggi-Alp which can be reached via the Lötschberg Tunnel', 
'\n')
formatted('20% of Swiss people speak Französisch but only 0.5% speak 
Rätoromanisch', '\n')
formatted('LÜSAI, lüsai, München, Neuchâtel, Ny-Ålesund, Tromsø, ZÜRICH', '\n')

print """BUGS: certain diacritical marks can and should be capitalized...
str.upper() does not .replace('à', 'À').replace('ä', 'Ä').replace('è', 
'È').replace('é', 'É').replace('ö', 'Ö').replace('ü', 'Ü'), etc.
str.lower() does not .replace('À', 'à').replace('Ä', 'ä').replace('È', 
'è').replace('É', 'é').replace('Ö', 'ö').replace('Ü', 'ü'), etc.
str.title() has the same problems plus it capitalizes the letter _after_ a 
diacritic. e.g. 'lüsai'.title() --> 'LÜSai' with a capitol 'S'
myUpper(), myLower(), myTitle() exhibit the correct behavior with a handful 
of diacritic marks."""

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> a = map(add, a, b) also crashes this.
>  a = chain(a, b) also.
> If, by "provisions" you speak of sys.max_recursion_depth, that is only
> invoked when executing "python" code.

There's nothing that prevents it from protecting C code.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

a = map(add, a, b) also crashes this.
 a = chain(a, b) also.
If, by "provisions" you speak of sys.max_recursion_depth, that is only invoked 
when executing "python" code.  What's happening here is just simple c recursion 
trough function pointers, ending in stack overflow, at least on Windows:


>   python33_d.dll!chain_next(chainobject * lz)  Line 1811 + 0x6 bytes  
> C
python33_d.dll!PyIter_Next(_object * iter)  Line 2741 + 0xf bytes   
C
python33_d.dll!chain_next(chainobject * lz)  Line 1823 + 0xc bytes  
C
python33_d.dll!PyIter_Next(_object * iter)  Line 2741 + 0xf bytes   
C
python33_d.dll!chain_next(chainobject * lz)  Line 1823 + 0xc bytes  
C
python33_d.dll!PyIter_Next(_object * iter)  Line 2741 + 0xf bytes   
C

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14587] Certain diacritical marks can and should be capitalized... e.g. ü --> Ü

2012-04-15 Thread R. David Murray

R. David Murray  added the comment:

It works fine if you use unicode.

--
nosy: +r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I'm now wondering if starmap() is tickling a bug in PyObject_Call,
> perhaps memory being allocated but not checked for NULL or somesuch.

The issue is that the code paths involved here circumvent recursion checking, 
so the stack blows up.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14587] Certain diacritical marks can and should be capitalized... e.g. ü --> Ü

2012-04-15 Thread Christian Clauss

New submission from Christian Clauss :

BUGS: certain diacritical marks can and should be capitalized...
str.upper() does not .replace('à', 'À').replace('ä', 'Ä').replace('è', 
'È').replace('é', 'É').replace('ö', 'Ö').replace('ü', 'Ü'), etc.
str.lower() does not .replace('À', 'à').replace('Ä', 'ä').replace('È', 
'è').replace('É', 'é').replace('Ö', 'ö').replace('Ü', 'ü'), etc.
str.title() has the same problems plus it capitalizes the letter _after_ a 
diacritic. e.g. 'lüsai'.title() --> 'LÜSai' with a capitol 'S'
myUpper(), myLower(), myTitle() exhibit the correct behavior with a handful 
of diacritic marks.

def myUpper(inString):
return inString.upper().replace('à', 'À').replace('ä', 'Ä').replace('è', 
'È').replace('é', 'É').replace('ö', 'Ö').replace('ü', 'Ü')

def myLower(inString):
return inString.lower().replace('À', 'à').replace('Ä', 'ä').replace('È', 
'è').replace('É', 'é').replace('Ö', 'ö').replace('Ü', 'ü')

def myTitle(inString): # WARNING: converts all whitespace to a single space
returnValue = []
for theWord in inString.split():
returnValue.append(myUpper(theWord[:1]) + myLower(theWord[1:]))
return ' '.join(returnValue)

--
components: Unicode
messages: 158332
nosy: Christian.Clauss, ezio.melotti
priority: normal
severity: normal
status: open
title: Certain diacritical marks can and should be capitalized... e.g. ü --> Ü
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14573] json iterencode can not handle general iterators

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

That's more of a feature request than a bug. By definition JSON can only 
represent a small subset of Python's types.
Also, if you encode an iterator as a JSON list, you will get back a Python list 
when decoding the JSON representation, so it won't round-trip.

--
nosy: +pitrou
stage: test needed -> needs patch
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset bf3b77722c9f by Mark Dickinson in branch '2.7':
Issue #13889: On MSVC builds, set FPU control word at runtime for all string 
<-> float conversions.  Patch by Samuel Iseli and Stefan Krah.
http://hg.python.org/cpython/rev/bf3b77722c9f

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset dfc9a98a5fef by Mark Dickinson in branch '3.2':
Issue #13889: On MSVC builds, set FPU control word at runtime for all string 
<-> float conversions.  Patch by Samuel Iseli and Stefan Krah.
http://hg.python.org/cpython/rev/dfc9a98a5fef

New changeset 7eca620feb10 by Mark Dickinson in branch 'default':
Issue #13889: Merge fix from 3.2.
http://hg.python.org/cpython/rev/7eca620feb10

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Hmm, substituting PyIter_Next() didn't help.  

There isn't much else being done in starmap.next, just a call to:
  result = PyObject_Call(lz->func, args, NULL);

I'm now wondering if starmap() is tickling a bug in PyObject_Call, perhaps 
memory being allocated but not checked for NULL or somesuch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11750] Mutualize win32 functions

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> New patch.  Compared to the previous one:
> 
> * socket functions have been moved from _windows to _multiprocessing
> * _windows.vcpoj has been removed (so _windows is part of pythoncore.vcproj)
> * no changes to pcbuild.sln needed
> * removed reference to 'win32_functions.c' in setup.py

I think the module would be better named _win32, since that's the name
of the API (like POSIX under Unix).

Also, it seems there are a couple of naming inconsistencies renaming
(e.g. the overlapped wrapper is named
"_multiprocessing.win32.Overlapped")

Otherwise, I guess it's ok.

> (I am not sure whether/how setup.py is used on Windows.)

Neither do I. It may be used under mingw or cygwin, but we don't
officially support these.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8212] A tp_dealloc of a subclassed class cannot resurrect an object

2012-04-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Another, less hacky but more intrusive, way would be to change the signature of 
tp_dealloc in a backwards compatible way:
typedef void (*destructor)(PyObject *, int *destroyed);

The destructor can then set the flag pointed to by 'destroyed' to 1 or 0, 
depending on whether actual destruction took place.  The caller will set the 
flag to '1' by default.

We could then change all internal destructors to conform, and know that 
external destructors will continue to work in the old way.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11750] Mutualize win32 functions

2012-04-15 Thread sbt

sbt  added the comment:

New patch.  Compared to the previous one:

* socket functions have been moved from _windows to _multiprocessing
* _windows.vcpoj has been removed (so _windows is part of pythoncore.vcproj)
* no changes to pcbuild.sln needed
* removed reference to 'win32_functions.c' in setup.py

(I am not sure whether/how setup.py is used on Windows.)

 Lib/multiprocessing/connection.py  |   124 +-
 Lib/multiprocessing/forking.py |31 +-
 Lib/multiprocessing/heap.py| 6 +-
 Lib/multiprocessing/reduction.py   | 6 +-
 Lib/subprocess.py  |   104 +-
 Lib/test/test_multiprocessing.py   | 2 +-
 Modules/_multiprocessing/multiprocessing.c |83 +-
 Modules/_multiprocessing/win32_functions.c |   823 
 Modules/_windows.c |  1337 +++
 PC/_subprocess.c   |   697 --
 PC/config.c| 6 +-
 PCbuild/_multiprocessing.vcproj| 4 -
 PCbuild/pythoncore.vcproj  | 8 +-
 setup.py   | 1 -
 14 files changed, 1568 insertions(+), 1664 deletions(-)

--
Added file: http://bugs.python.org/file25223/windows_module.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14507] Segfault with deeply nested starmap calls

2012-04-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

The "RuntimeError: maximum recursion depth exceeded" message is normally only 
triggered by pure Python recursion, so I would not have expected it here, but 
there should be some sort of graceful MemoryError or somesuch rather than a 
segfault.

The following code narrows it down to some issue in starmap():

def gstarmap(func, iterable):
for tup in iterable:
yield func(*tup)

def mylist(iterable):
return [x for x in iterable]

a = b = [1]
for i in xrange(10):

# Things that trigger a segfault:   
   
#a = starmap(add, izip(a, b))   
 
#a = starmap(add, iter( (a, b)  ))  
 
a = starmap(add, (a, b)  )

# Things that exit cleanly with a RuntimeError  
 
#a = gstarmap(add, iter( (a, b)  )) 
 
#a = (x+y   for x, y in iter( (a, b)  )) 

mylist(a)

One possibility may be that starmap.next needs to clear StopIteration 
exceptions in the same way as PyIter_Next():

if (result == NULL &&
PyErr_Occurred() &&
PyErr_ExceptionMatches(PyExc_StopIteration))
PyErr_Clear();

--
priority: normal -> low
title: Segfault with starmap and izip combo -> Segfault with deeply nested 
starmap calls

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12081] Remove distributed copy of libffi

2012-04-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I don't think we have ever "supported" WinCE (which is apparently named 
"Windows Embedded Compact 7" nowadays). It only provides a subset of the Win32 
API so the current tree may not even compile.

--
nosy: +brian.curtin, loewis, pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12081] Remove distributed copy of libffi

2012-04-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +meador.inge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2012-04-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage: needs patch -> patch review
versions: +Python 3.3 -Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8212] A tp_dealloc of a subclassed class cannot resurrect an object

2012-04-15 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Here is a patch that rectifies this situation, albeit in a somewhat 'hacky' 
manner.
It works by injecting a monitoring 'tp_free' call into the type during the 
basedealloc call, which sets a flag if it was called with the object, i.e. if 
actual deletion took place.
This value is then returned, and a decision to decref the object's "type" is 
made on this result.

--
keywords: +patch
versions: +Python 3.3 -Python 3.2
Added file: http://bugs.python.org/file25222/basedealloc.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2012-04-15 Thread Alex Leach

Changes by Alex Leach :


Added file: http://bugs.python.org/file25221/ffi64.c.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >