[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Changes by Richard Hansen :


Added file: http://bugs.python.org/file37953/doc_c-api_buffer.patch

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Changes by Richard Hansen :


Removed file: http://bugs.python.org/file37952/doc_c-api_buffer.patch

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Changes by Richard Hansen :


Removed file: http://bugs.python.org/file37953/doc_c-api_buffer.patch

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Changes by Richard Hansen :


Added file: http://bugs.python.org/file37954/doc_c-api_buffer.patch

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Richard Hansen added the comment:

> This leaves me +-0 for the change, with the caveat that applications
> might break.

How might an application break with this change?  Compared to the current 
PyBuffer_IsContiguous(), the patched version is the same except it returns true 
for a wider range of actually-contiguous buffers.

--

___
Python tracker 

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



[issue23359] Speed-up set_lookkey()

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>>> s = set()
>>> s.add(1<<64)
>>> s.add(2<<64)
>>> s.add(3<<64)
>>> list(s)
[36893488147419103232, 18446744073709551616, 55340232221128654848]
>>> s.discard(1<<64)
>>> s.discard(2<<64)
>>> s.add(3<<64)
>>> list(s)
[55340232221128654848, 55340232221128654848]

--

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Stefan Krah

Stefan Krah added the comment:

> Richard Hansen added the comment:
> > Cython doesn't follow the spec though (use Python 3):
> > 
> > from _testbuffer import *
> > cpdef foo():
> > cdef unsigned char[:] v = bytearray(b"testing")
> > nd = ndarray(v, getbuf=PyBUF_ND)
> > print(nd.suboffsets)
> > nd = ndarray(v, getbuf=PyBUF_FULL)
> > print(nd.suboffsets)
> 
> When I compile and run the above (latest Cython from Git master), I get:
> 
> ()
> ()

With Cython version 0.20.1post0 I get:

>>> foo.foo()
(-1,)
(-1,)

If you get the correct output from the latest Cython, it looks like this
issue has been fixed.

--

___
Python tracker 

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



[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

Here is another addition to the existing test suite to detect the bug with the 
duplicate 404 Not Found responses. It relies on running the non-Windows, 
non-root test that says

# chmod() doesn't work as expected on Windows, and filesystem
# permissions are ignored by root on Unix

In other words, you trigger it by requesting an unreadable file or directory.

Thanks for your replies to my comments, I think I am understanding your point 
of view better now. You want functions to either return a file object, or to 
mutate the connection and send part of the response, but not both (except for 
sending an error response):

* get_file() returns a file object only
* redirect() sends response headers only

I am trying find a neater way to avoiding calling apply_headers() when 
list_directory() has already sent the headers. How do you feel about calling 
apply_headers() from inside get_file_or_dir() and get_index_file()? Or at least 
put a big fat warning saying get_file_or_dir() may or may not have already sent 
the headers, indicated by the type of file returned.

Another option might be to split list_directory() into a get-file stage and an 
apply-headers stage. But in my experience the headers to send are usually 
tightly coupled with the content body. In this case both vary depending on the 
redirect, generated directory, or static file cases.

--
Added file: http://bugs.python.org/file37955/index-test.2.patch

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Stefan Krah

Stefan Krah added the comment:

> How might an application break with this change?

func1:
   if (!PyBuffer_IsContiguous(view, 'C'))
   error();

   func2(view);

func2:
   assert(view->suboffsets == NULL);
   ...

Yes, I *did* insert sanity checks like this in some places.

--

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Richard Hansen added the comment:

>> When I compile and run the above (latest Cython from Git master), I
>> get:
>> 
>> ()
>> ()
> 
> With Cython version 0.20.1post0 I get:
> 
> >>> foo.foo()
> (-1,)
> (-1,)
> 
> If you get the correct output from the latest Cython, it looks like
> this issue has been fixed.

Oops, I was running a locally modified version of Cython that contained a patch 
meant to work around issue #23349.

When I run the *actual* upstream master I get the same behavior that you do.

But either way, I don't see why it's a problem that it prints (-1,) for the 
PyBUF_ND case.  The consumer didn't request suboffsets information so I would 
expect it to be OK for the producer to put whatever it wants in the suboffsets 
field, including a junk pointer that would segfault upon dereference.

--

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Richard Hansen added the comment:

>> How might an application break with this change?
> 
>assert(view->suboffsets == NULL);

Fair point.

--

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Sebastian Berg

Sebastian Berg added the comment:

I do not have an opinion either way, but I do think there is a small difference 
here compared to the other issue. With the other issue, there are cases where 
we cannot set the strides correctly.

If you ask numpy directly whether the array is contiguous (or create it from 
numpy) and it says "yes", and then you get it without asking for a contiguous 
array it is, without the change, possible to get an array that would *not* be 
considered contiguous.

On the other hand, setting suboffsets to NULL when all are -1 is always 
possible, if tedious I admit.

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2015-02-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

.signature also handles wrapped functions better.

>>> def deco(f):
import functools
@functools.wraps(f)
def ret(*args, **kw):
return f(*args, **kw)
return ret

>>> @deco
def f(n, k):
return n + k*2

>>> import inspect as ip
>>> isf=ip.signature(f)
>>> print(isf)
(n, k)
>>> ip.formatargspec(*ip.getfullargspec(f))
'(*args, **kw)'

--

___
Python tracker 

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



[issue23352] PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != NULL

2015-02-01 Thread Richard Hansen

Richard Hansen added the comment:

My preference is to apply the patch, of course.  There is a legitimate concern 
that it will break existing code, but I think there are more points in favor of 
applying the patch:
  * there exists code that the current behavior is known to break
  * it's easier to remove assert(view->suboffsets == NULL) than to
change producers to not provide an all-negative array (though I
admit there may be other more subtle ways the patch would break
existing code)
  * I may be the only one who has spoken up about this, but I doubt
I'm the only one who has experienced it

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2015-02-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The above suggests that the change might be applied to 3.4.  The difference 
surprises me because #17481 patched getfullargspec() to 'use' signature() 
'behind the scenes', so I expected the result to be the same.  It seems that 
'use' does not mean what I thought.  My hesitation is that only some builtins 
have been converted to use Argument Clinic, and Idle currently treats builtins 
special to get the signature from the docstring.  Treating just some builting 
special will be slightly awkward.

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2015-02-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

An example should make my concern clearer. str(signature(int)) is '()' because 
int (and all other builtins) has not been converted whereas the Idle calltip is
  int(x=0) -> integer
  int(x, base=10) -> integer
I do not want to simply add a line with '()' to the top of the calltip, so a 
little thought is needed to improve the calltip for the rare cases above 
without degrading them for existing, more common cases.

--

___
Python tracker 

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



[issue22818] Deprecate splitting on possible zero-width re patterns

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I hesitate about warning type. Originally I was going to emit a 
DeprecationWarning in 3.5, may be change it to a UserWarning in 3.6, and raise 
a ValueError or change behavior in 3.7. What would be better?

--

___
Python tracker 

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



[issue23099] BytesIO and StringIO values unavailable when closed

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, it would be good to make the documentation of BytesIO and StringIO 
consistent.

--

___
Python tracker 

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



[issue23321] Crash in str.decode() with special error handler

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If you have no enhancements to my quick fix Victor, may be this issue can be 
closed.

--
status: open -> pending

___
Python tracker 

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



[issue23055] PyUnicode_FromFormatV crasher

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23352] Document "suboffsets if needed" in 2.7

2015-02-01 Thread Stefan Krah

Stefan Krah added the comment:

But only Cython does not set suboffsets to NULL and you already have a small 
patch to fix that.

The Python 3 docs say "suboffsets only if needed" and the PEP says the same,
so the situation is not completely undocumented.


I think your doc patch goes too far.  Buffers propagate in unpredictable ways, 
and since the original consumer request is *not stored* in the buffer, setting
unneeded fields to NULL provides a way to figure out the original request.


It is actually *an optimization* to set suboffsets to NULL:  Compliant code
that uses arbitrary buffers always has to check for:

if (suboffsets != NULL && suboffsets[i] >= 0)
...


If suboffsets are consistently NULL, at least hopefully you get branch 
prediction to kick in.


As Sebastian pointed out, it's relatively easy even for slicing/indexing
functions to check for all-negative suboffsets and handle that case.


All this is probably academic, since no one appears to be using suboffsets
at all. :)



Let's keep the status-quo and make this a doc issue for 2.7.

--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python
priority: normal -> low
stage: patch review -> 
title: PyBuffer_IsContiguous() sometimes returns wrong result if suboffsets != 
NULL -> Document "suboffsets if needed" in 2.7
type: behavior -> enhancement

___
Python tracker 

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



[issue22818] Deprecate splitting on possible zero-width re patterns

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be RuntimeWarning or FutureWarning are more appropriate?

--

___
Python tracker 

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



[issue12916] Add inspect.splitdoc

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

Uploading issue12916-splitdoc-5.patch:

* Documented TypeError
* Added stacklevel=2 to warning
* Test improvements
* Dropped the test for pydoc.splitdoc() removal

--
Added file: http://bugs.python.org/file37956/issue12916-splitdoc-5.patch

___
Python tracker 

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



[issue15608] Improve socketserver doc

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

Main changes in socketserver-doc.2.patch:

* Documented constructor parameters for the server classes
* Indented class methods and attributes underneath class headings

--
Added file: http://bugs.python.org/file37957/socketserver-doc.2.patch

___
Python tracker 

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



[issue20204] pydocs fails for some C implemented classes

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which adds a warning to PyType_FromSpec and 
PyType_FromSpecWithBases if type spec name doesn't contain module name. In 
conjunction with tkinter_typespecs.patch it should fix the issue.

--
stage: needs patch -> patch review
Added file: http://bugs.python.org/file37958/type_from_spec_module.patch

___
Python tracker 

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



[issue23360] Content-Type when sending data with urlopen()

2015-02-01 Thread Martin Panter

New submission from Martin Panter:

Currently the documentation gives the impression that the “data” parameter to 
Request() has to be in the application/x-www-form-urlencoded format. However I 
suspect that you can override the type by supplying a Content-Type header, and 
I would like to document this; see uploaded patch.

I noticed that test_urllib2.HandlerTests.test_http() already seems to test the 
default Content-Type and a custom Content-Type with a Request() object, 
although I did not see a test for the default Content-Type when supplying 
“data” directly to urlopen().

Also I understand the “charset” parameter on application/x-www-form-urlencoded 
is not standardized. Would it correspond to the encoding of the %XX codes from 
urlencode(), which is typically UTF-8, not Latin-1? Or would it correspond to 
the subsequent string-to-bytes encoding stage, which could just be ASCII since 
non-ASCII characters are already encoded? Maybe it would be best to drop the 
advice to set a “charset” parameter. It was added for Issue 11082.

--
assignee: docs@python
components: Documentation
files: non-urlencoded.patch
keywords: patch
messages: 235166
nosy: docs@python, vadmium
priority: normal
severity: normal
status: open
title: Content-Type when sending data with urlopen()
versions: Python 3.4
Added file: http://bugs.python.org/file37959/non-urlencoded.patch

___
Python tracker 

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



[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-02-01 Thread Ent

Ent added the comment:

@vadmium: Thanks for the suggestion - I opted for the first one. While I wasn't 
happy with it being called twice, wasn't getting an idea of how to address it. 
Am I supposed to include your patch as part of my patch? I am not much 
knowledgeable about the protocol to follow in such cases, so I haven't included 
it.

--
Added file: http://bugs.python.org/file37960/Feb1stb.patch

___
Python tracker 

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



[issue5187] distutils upload should prompt for the user/password too

2015-02-01 Thread Geoffrey Spear

Changes by Geoffrey Spear :


--
nosy: +geoffreyspear

___
Python tracker 

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



[issue18454] distutils crashes when uploading to PyPI having only the username (no pw) defined

2015-02-01 Thread Geoffrey Spear

Changes by Geoffrey Spear :


--
nosy: +geoffreyspear

___
Python tracker 

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



[issue23361] integer overflow in winapi_createprocess

2015-02-01 Thread paul

New submission from paul:

winapi_createprocess takes env_mapping dictionary as a parameter, mapping 
variables to their env. values. Dictionary with pathologically large values 
will cause an integer overflow during computation of total space required to 
store all key-value pairs


File: Modules\_winapi.c

static PyObject*
getenvironment(PyObject* environment)
{
Py_ssize_t i, envsize, totalsize;
...
envsize = PyMapping_Length(environment);

keys = PyMapping_Keys(environment);
values = PyMapping_Values(environment);
if (!keys || !values)
goto error;

totalsize = 1; /* trailing null character */
for (i = 0; i < envsize; i++) {
PyObject* key = PyList_GET_ITEM(keys, i);
PyObject* value = PyList_GET_ITEM(values, i);

if (! PyUnicode_Check(key) || ! PyUnicode_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"environment can only contain strings");
goto error;
}
totalsize += PyUnicode_GET_LENGTH(key) + 1;/* +1 for '=' */
1   totalsize += PyUnicode_GET_LENGTH(value) + 1;  /* +1 for '\0' */
}

2   buffer = PyMem_Malloc(totalsize * sizeof(Py_UCS4));
if (! buffer)
goto error;
p = buffer;
3   end = buffer + totalsize;

4   for (i = 0; i < envsize; i++) {
PyObject* key = PyList_GET_ITEM(keys, i);
PyObject* value = PyList_GET_ITEM(values, i);
X   if (!PyUnicode_AsUCS4(key, p, end - p, 0))
goto error;
p += PyUnicode_GET_LENGTH(key);
X   *p++ = '=';
X   if (!PyUnicode_AsUCS4(value, p, end - p, 0))
goto error;
p += PyUnicode_GET_LENGTH(value);
X   *p++ = '\0';
}

1. no overflow checks. We can set totalsize to 2^30, with a crafted dictionary.
2. totalsize*4 == 0, so buffer is 0-bytes long
3. end = buffer+2^30
4. envsize == len(env_mapping). We can make this variable as large as we like. 
X. write past the buffer's end. Note size checks in PyUnicode_AsUCS4 are 
inefficient, because the size variable (end-p) is very large.

--
messages: 235168
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in winapi_createprocess
type: crash
versions: Python 3.4

___
Python tracker 

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



[issue23362] integer overflow in string translate

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# PyObject *
# _PyUnicode_TranslateCharmap(PyObject *input,
# PyObject *mapping,
# const char *errors)
# {
# ...
# size = PyUnicode_GET_LENGTH(input);
# ...
# osize = size;
# 1   output = PyMem_Malloc(osize * sizeof(Py_UCS4));
# 
# 1. Input size = 2^30, so osize*sizeof(Py_UCS4)=2^32==0 (modulo 2^32) and 
malloc
#allocates a 0 byte buffer
# 
# Crash
# -
# 
# Breakpoint 2, _PyUnicode_TranslateCharmap (
# input='aa...', mapping={97: 'b'}, errors=0x828c82b "ignore") at 
Objects/unicodeobject.c:8597
# 8597{
# ...
# 8636output = PyMem_Malloc(osize * sizeof(Py_UCS4));
# (gdb) print osize
# $1 = 1073741824
# (gdb) print osize*4
# $2 = 0
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x0814aed2 in charmaptranslate_output (
# input='aa...', ipos=51302, mapping={97: 'b'}, output=0xbfc40860, 
osize=0xbfc40864, opos=0xbfc40868,
# res=0xbfc40874) at Objects/unicodeobject.c:8574
# 8574(*output)[(*opos)++] = PyUnicode_READ_CHAR(*res, 0);
# 
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  
 
s="a"*(2**30)
s.translate({ord('a'): 'b'})

--
files: poc_translate.py
messages: 235169
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in string translate
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37961/poc_translate.py

___
Python tracker 

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



[issue23363] integer overflow in itertools.permutations

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# static PyObject *
# permutations_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
# {
# ...
# 1   cycles = PyMem_Malloc(r * sizeof(Py_ssize_t));
# ...
# for (i=0 ; i0, so we write well beyond the buffer's end
# 
# Crash
# -
# 
# Breakpoint 1, permutations_new (type=0x83394e0 , 
args=('A', 1073741824), kwds=0x0) at ./Modules/itertoolsmodule.c:3012
# ...
# 3044indices = PyMem_Malloc(n * sizeof(Py_ssize_t));
# (gdb) print r
# $2 = 1073741824
# (gdb) print r*4
# $3 = 0
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x08230900 in permutations_new (type=0x83394e0 , 
args=('A', 1073741824), kwds=0x0) at ./Modules/itertoolsmodule.c:3054
# 3054cycles[i] = n - i;
# 
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  
 
import itertools as it
it.permutations("A", 2**30)

--
files: poc_permutations.py
messages: 235170
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in itertools.permutations
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37962/poc_permutations.py

___
Python tracker 

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



[issue23364] integer overflow in itertools.product

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# static PyObject *
# product_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
# {
# ...
# 1   nargs = (repeat == 0) ? 0 : PyTuple_GET_SIZE(args);
# 2   npools = nargs * repeat;
# 
# 3   indices = PyMem_Malloc(npools * sizeof(Py_ssize_t));
# ...
# 
# 4   for (i=0; i < nargs ; ++i) {
# ...
# indices[i] = 0;
# }
# 
# 1. nargs is the number of functions arguments (not counting the keyword arg).
#We set this value to 2^16 using argument unpacking (*args).
# 2. We set the 'repeat' keyword argument to 2^16, so npools=2^32==0 (modulo 
2^32)
# 3. npools*4=0, so malloc allocates a 0 byte buffer
# 4. nargs=2^16, so the loop writes well beyond the buffer's end
# 
# Breakpoint 1, product_new (type=0x8338c80 ,
# args=('a', ...(truncated), kwds={'repeat': 65536})
# at ./Modules/itertoolsmodule.c:1998
# ...
# 2021nargs = (repeat == 0) ? 0 : PyTuple_GET_SIZE(args);
# (gdb) n
# 2022npools = nargs * repeat;
# (gdb) print nargs
# $14 = 65536
# (gdb) print repeat
# $15 = 65536
# (gdb) n
# 2024indices = PyMem_Malloc(npools * sizeof(Py_ssize_t));
# (gdb) print npools
# $16 = 0
# (gdb) c
# Continuing.
#  
# Crash
# -
# 
# We crash in a different place, because there was sufficient allocated memory
# after the "indices" buffer.
# 
# Program received signal SIGSEGV, Segmentation fault.
# 0x08313940 in PyTuple_Type ()
# (gdb) bt
# #0  0x08313940 in PyTuple_Type ()
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# #1  0x080f27c7 in PyObject_Hash (v=) at Objects/object.c:747
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# #2  0x080e132f in PyDict_GetItem (op=, key=) at Objects/dictobject.c:1070
# #2  0x080e132f in PyDict_GetItem (op=, key=) at Objects/dictobject.c:1070
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# #3  0x080e5261 in _PyDict_GetItemId (dp=, key=0x832bd20 
) at Objects/dictobject.c:2729
# #4  0x0806f0e8 in _PySys_GetObjectId (key=0x832bd20 ) 
at ./Python/sysmodule.c:57
# #5  0x081bb52a in PyEval_EvalFrameEx (f=Frame 0x404ea1ac, for file , 
line 1, in  (), throwflag=0) at Python/ceval.c:1848
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# #6  0x081c8574 in PyEval_EvalCodeEx (_co=, 
globals=, locals=, args=0x0, argcount=0, kws=0x0, kwcount=0,
# defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:3578
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# #7  0x081b51ef in PyEval_EvalCode (co=, globals=, 
locals=) at Python/ceval.c:773
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# Python Exception  'utf8' codec can't 
decode byte 0xc8 in position 1: invalid continuation byte:
# #8  0x08065e89 in run_mod (mod=0x9ea5758, filename='', globals=, 
locals=, flags=0xbf85fbc0, arena=0x9e64220)
# at Python/pythonrun.c:2180
# #9  0x080637fd in PyRun_InteractiveOneObject (fp=0x40231ac0 <_IO_2_1_stdin_>, 
filename='', flags=0xbf85fbc0)
# at Python/pythonrun.c:1445
# #10 0x08063243 in PyRun_InteractiveLoopFlags (fp=0x40231ac0 <_IO_2_1_stdin_>, 
filename_str=0x826bc06 "", flags=0xbf85fbc0)
# at Python/pythonrun.c:1324
# #11 0x0806305f in PyRun_AnyFileExFlags (fp=0x40231ac0 <_IO_2_1_stdin_>, 
filename=0x826bc06 "", closeit=0, flags=0xbf85fbc0)
# at Python/pythonrun.c:1286
# #12 0x08079e8a in run_file (fp=0x40231ac0 <_IO_2_1_stdin_>, filename=0x0, 
p_cf=0xbf85fbc0) at Modules/main.c:319
# #13 0x0807a988 in Py_Main (argc=1, argv=0x9e45010) at Modules/main.c:751
# #14 0x0805dc34 in main (argc=1, argv=0xbf85fd04) at ./Modules/python.c:69
#  
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  

import itertools as it
args=["a"]*(2**16)
it.product(*args, repeat=2**16)

--
files: poc_product.py
messages: 235172
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in itertools.product
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37963/poc_product.py

___
Python tracker 

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



[issue22445] Memoryviews require more strict contiguous checks then necessary

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 369300948f3f by Stefan Krah in branch 'default':
Issue #22445: PyBuffer_IsContiguous() now implements precise contiguity
https://hg.python.org/cpython/rev/369300948f3f

--
nosy: +python-dev

___
Python tracker 

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



[issue23365] integer overflow in itertools.combinations_with_replacement

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# static PyObject *
# cwr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
# {
# ...
# 1   indices = PyMem_Malloc(r * sizeof(Py_ssize_t));
# ...
# for (i=0 ; i0, so we write well beyond the buffer's end
# 
# Crash
# -
# 
# Breakpoint 1, cwr_new (type=0x83392a0 , args=('AA', 1073741824), 
kwds=0x0) at ./Modules/itertoolsmodule.c:2684
# 2684PyObject *pool = NULL;
# ...
# 2703indices = PyMem_Malloc(r * sizeof(Py_ssize_t));
# (gdb) print r
# $1 = 1073741824
# (gdb) print r*4
# $2 = 0
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x0822fdcd in cwr_new (type=0x83392a0 , args=('AA', 1073741824), 
kwds=0x0) at ./Modules/itertoolsmodule.c:2710
# 2710indices[i] = 0;
# 
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  
 
import itertools as it
it.combinations_with_replacement("AA", 2**30)

--
files: poc_cwr.py
messages: 235173
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in itertools.combinations_with_replacement
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37964/poc_cwr.py

___
Python tracker 

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



[issue23366] integer overflow in itertools.combinations

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# static PyObject *
# combinations_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
# {
# ...
# 
# 1   indices = PyMem_Malloc(r * sizeof(Py_ssize_t));
# ...
# 
# for (i=0 ; i0, so we write well beyond the buffer's end
# 
# Crash
# -
# 
# Breakpoint 1, combinations_new (type=0x83390c0 , 
args=('AA', 1073741824), kwds=0x0)
# at ./Modules/itertoolsmodule.c:2343
# 2343PyObject *pool = NULL;
# ...
# (gdb) n
# 2362indices = PyMem_Malloc(r * sizeof(Py_ssize_t));
# (gdb) print r
# $1 = 1073741824
# (gdb) print r*4
# $2 = 0
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x0822f359 in combinations_new (type=0x83390c0 , 
args=('AA', 1073741824), kwds=0x0)
# at ./Modules/itertoolsmodule.c:2369
# 2369indices[i] = i;


# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  
 
import itertools as it
it.combinations("AA", 2**30)

--
files: poc_combinations.py
messages: 235174
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in itertools.combinations
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37965/poc_combinations.py

___
Python tracker 

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



[issue23367] integer overflow in unicodedata.normalize

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# static PyObject*
# unicodedata_normalize(PyObject *self, PyObject *args)
# {
# ...
# if (strcmp(form, "NFKC") == 0) {
# if (is_normalized(self, input, 1, 1)) {
# Py_INCREF(input);
# return input;
# }
# return nfc_nfkc(self, input, 1);
# 
# We need to pass the is_normalized() check (repeated \xa0 char takes care of 
# that). nfc_nfkc calls:
# 
# static PyObject*
# nfd_nfkd(PyObject *self, PyObject *input, int k)
# {
# ...
# Py_ssize_t space, isize;
# ...
# isize = PyUnicode_GET_LENGTH(input);
# /* Overallocate at most 10 characters. */
# space = (isize > 10 ? 10 : isize) + isize;
# osize = space;
# 1   output = PyMem_Malloc(space * sizeof(Py_UCS4));
# 
# 1. if isize=2^30, then space=2^30+10, so space*sizeof(Py_UCS4)=(2^30+10)*4 ==
#40 (modulo 2^32), so PyMem_Malloc allocates buffer too small to hold the
#result.
# 
# Crash
# -
# 
# nfd_nfkd (self=, input='...', k=1) at 
/home/p/Python-3.4.1/Modules/unicodedata.c:552
# 552 stackptr = 0;
# (gdb) n
# 553 isize = PyUnicode_GET_LENGTH(input);
# (gdb) n
# 555 space = (isize > 10 ? 10 : isize) + isize;
# (gdb) n
# 556 osize = space;
# (gdb) n
# 557 output = PyMem_Malloc(space * sizeof(Py_UCS4));
# (gdb) print space
# $9 = 1073741834
# (gdb) print space*4
# $10 = 40
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x40579cbb in nfd_nfkd (self=, input='', k=1) at 
/home/p/Python-3.4.1/Modules/unicodedata.c:614
# 614 output[o++] = code;
# 
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
 
 
import unicodedata as ud
s="\xa0"*(2**30)
ud.normalize("NFKC", s)

--
files: poc_unidata_normalize.py
messages: 235175
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in unicodedata.normalize
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37966/poc_unidata_normalize.py

___
Python tracker 

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



[issue23368] integer overflow in _PyUnicode_AsKind

2015-02-01 Thread paul

New submission from paul:

# Bug
# ---
# 
# void*
# _PyUnicode_AsKind(PyObject *s, unsigned int kind)
# {
# Py_ssize_t len;
# ...
# len = PyUnicode_GET_LENGTH(s);
# ...
# switch (kind) {
# ...
# case PyUnicode_4BYTE_KIND:
# 1   result = PyMem_Malloc(len * sizeof(Py_UCS4));
# ...
# else {
# assert(skind == PyUnicode_1BYTE_KIND);
# 2   _PyUnicode_CONVERT_BYTES(
# Py_UCS1, Py_UCS4,
# PyUnicode_1BYTE_DATA(s),
# PyUnicode_1BYTE_DATA(s) + len,
# result);
# }
# 
# 1. len equals 2^30, so len*sizeof(Py_UCS4)=2^30*2^2=2^32, which gets casted 
#down to 0, since PyMem_Malloc takes size_t as the parameter. Resulting 
buffer
#is 0 bytes big.
# 2. chars from the source string s (which are 1 byte long) are expanded to 4 
#bytes and copied to the 'result' buffer, which is too small to hold them 
all
# 
# Stack trace
# ---
# 
# Breakpoint 2, _PyUnicode_AsKind (
# s='a...', kind=4) at Objects/unicodeobject.c:2176
# 2176if (PyUnicode_READY(s) == -1)
# (gdb) n
# 2179len = PyUnicode_GET_LENGTH(s);
# (gdb) n
# 2180skind = PyUnicode_KIND(s);
# (gdb) n
# 2181if (skind >= kind) {
# (gdb) n
# 2185switch (kind) {
# (gdb) n
# 2198result = PyMem_Malloc(len * sizeof(Py_UCS4));
# (gdb) print len
# $10 = 1073741824
# (gdb) print skind
# $11 = 1
# (gdb) print kind
# $12 = 4
# (gdb) print len*4
# $13 = 0
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x08130b56 in _PyUnicode_AsKind (
# s='a...', kind=4) at Objects/unicodeobject.c:2210
# 2210_PyUnicode_CONVERT_BYTES(
# 
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  
# POC
# ---

txt=b"\x0a\x0a\x0a\x00"
uni=txt.decode("utf-32")
sub="a"*(2**30)
uni.count(sub)

--
files: poc_askind.py
messages: 235176
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in _PyUnicode_AsKind
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37967/poc_askind.py

___
Python tracker 

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2015-02-01 Thread paul

New submission from paul:

# static PyObject *
# ascii_escape_unicode(PyObject *pystr)
# {
# ...
# 
# input_chars = PyUnicode_GET_LENGTH(pystr);
# input = PyUnicode_DATA(pystr);
# kind = PyUnicode_KIND(pystr);
# 
# /* Compute the output size */
# for (i = 0, output_size = 2; i < input_chars; i++) {
# Py_UCS4 c = PyUnicode_READ(kind, input, i);
# if (S_CHAR(c))
# output_size++;
# else {
# switch(c) {
# ...
# default:
# 1   output_size += c >= 0x1 ? 12 : 6;
# ...
# 
# 2   rval = PyUnicode_New(output_size, 127);
# 
# 1. if c is \u then output_size += 6. There are no overflow checks on this 
#variable, so we can overflow it with a sufficiently long (2**32/6+1 chars) 
#string
# 2. rval buffer is too small to hold the result
# 
# Crash:
# --
#  
# Breakpoint 3, ascii_escape_unicode (pystr='...') at 
/home/p/Python-3.4.1/Modules/_json.c:198
# 198 rval = PyUnicode_New(output_size, 127);
# (gdb) print output_size
# $9 = 4
# (gdb) c
# Continuing.
#  
# Program received signal SIGSEGV, Segmentation fault.
# 0x4057888f in ascii_escape_unichar (c=65535,
# output=0x40572358 "...",
# chars=19624) at /home/p/Python-3.4.1/Modules/_json.c:155
# 155 output[chars++] = Py_hexdigits[(c >>  8) & 0xf];
# 
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
#  
 
from _json import encode_basestring_ascii as enc
s="\u"*int((2**32)/6+1)
enc(s)

--
files: poc_ascii_escape.py
messages: 235177
nosy: pkt
priority: normal
severity: normal
status: open
title: integer overflow in _json.encode_basestring_ascii
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37968/poc_ascii_escape.py

___
Python tracker 

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



[issue22445] Memoryviews require more strict contiguous checks then necessary

2015-02-01 Thread Stefan Krah

Changes by Stefan Krah :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue23370] PyBuffer_FromContiguous() off-by-one error for non-contiguous buffers

2015-02-01 Thread Stefan Krah

New submission from Stefan Krah:

Same as #23349.

--
messages: 235178
nosy: skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: PyBuffer_FromContiguous() off-by-one error for non-contiguous buffers
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue23370] PyBuffer_FromContiguous() off-by-one error for non-contiguous buffers

2015-02-01 Thread Stefan Krah

Changes by Stefan Krah :


--
keywords: +patch
Added file: http://bugs.python.org/file37969/issue23370.diff

___
Python tracker 

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



[issue23371] mimetypes initialization fails on Windows because of TypeError

2015-02-01 Thread Stéphane Lenclud

New submission from Stéphane Lenclud:

On my Windows 7 installation mimetypes.py in read_windows_registry 
_winreg.OpenKey can throw a TypeError exception which is not handled and 
interrupts the execution.

To fix it I added:
except TypeError:
continue

To reproduce it I just need to run te following:
c:\python27\python -c "import mimetypes; mimetypes.init()"

This error is obviously due to the content of my registry.
The subkeyname causing issues have names like: 
{hexid-hexid-hexid-hexid-hexid}

--
components: Windows
messages: 235179
nosy: Slion, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: mimetypes initialization fails on Windows because of TypeError
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread Alec Nikolas Reiter

New submission from Alec Nikolas Reiter:

Not something I've noticed until today, but defaultdict.fromkeys only accepts 
an iterable of keys and an initial value. To set the default_factory for the 
newly created collection, you need to prod at the attribute itself.

This isn't a huge issue for me, however adding an optional default_factory to 
fromkeys would be a nice convenience.

--
messages: 235180
nosy: justanr
priority: normal
severity: normal
status: open
title: defaultdict.fromkeys should accept a callable factory
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread SilentGhost

SilentGhost added the comment:

Correct me if I'm wrong but this seem as a very unlikely use case. Why would 
you need to ensure content of the defaultdict (i.e., why would you ever use its 
fromkeys method)? And, perhaps, having to implicitly assign default factory is 
not such a bad tradeoff, considering implementation overhead.

--
components: +Library (Lib)
nosy: +SilentGhost
versions:  -Python 3.4

___
Python tracker 

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



[issue14099] ZipFile.open() should not reopen the underlying file

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4f96e9a8eee8 by Serhiy Storchaka in branch 'default':
Don't seek to the start of the file when open ZipFile with the 'w' mode
https://hg.python.org/cpython/rev/4f96e9a8eee8

--

___
Python tracker 

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



[issue23373] curses.textpad crashes in insert mode on wide window

2015-02-01 Thread Alex Martelli

New submission from Alex Martelli:

http://stackoverflow.com/questions/28264353/stack-overflow-in-pythons-curses-is-it-bug-in-the-module/28264823#28264823
 for details.  a curses.textpad on a wide-enough window, in insert mode, causes 
a crash by recursion limit exceeded (in _insert_printable_char) upon edit.  
Workaround is to keep the window underlying the textpad sufficiently narrow.

--
components: Library (Lib)
messages: 235182
nosy: Alex.Martelli
priority: normal
severity: normal
status: open
title: curses.textpad crashes in insert mode on wide window
type: crash
versions: Python 3.4

___
Python tracker 

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



[issue23252] Add support of writing to unseekable file in zipfile

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. Mercurial wouldn't need a wrapper in Python 3.5.

--
keywords: +patch
nosy: +Matt.Mackall
stage: needs patch -> patch review
Added file: http://bugs.python.org/file37970/zipfile_write_unseekable.patch

___
Python tracker 

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



[issue23362] integer overflow in string translate

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Do you want to provide a patch?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +rhettinger

___
Python tracker 

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



[issue23371] mimetypes initialization fails on Windows because of TypeError

2015-02-01 Thread R. David Murray

R. David Murray added the comment:

Is this a duplicate of issue 9291?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-0  I could see some use cases for this, dict.fromkeys(contestants, 
factory=list), but it adds complexity to a core container API and it starts to 
overlap the use cases for collections.defaultdict().

Perhaps set comprehensions should remain the one-obvious-way-to-do-it:
   {k : [] for k in contestants}

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue23371] mimetypes initialization fails on Windows because of TypeError

2015-02-01 Thread Stéphane Lenclud

Stéphane Lenclud added the comment:

I don't think so.
Here is the traceback btw:
  File "setup.py", line 18, in 
exec(init_file.read(), command_ns)
  File "", line 11, in 
  File 
"c:\users\sl\appdata\local\temp\tmpoaaddk\setuptools-12.0.5\setuptools\__init__.py",
 line 11, in 
from setuptools.extension import Extension
  File 
"c:\users\sl\appdata\local\temp\tmpoaaddk\setuptools-12.0.5\setuptools\extension.py",
 line 8, in 
from .dist import _get_unpatched
  File 
"c:\users\sl\appdata\local\temp\tmpoaaddk\setuptools-12.0.5\setuptools\dist.py",
 line 16, in 
from setuptools.depends import Require
  File 
"c:\users\sl\appdata\local\temp\tmpoaaddk\setuptools-12.0.5\setuptools\depends.py",
 line 6, in 
from setuptools import compat
  File 
"c:\users\sl\appdata\local\temp\tmpoaaddk\setuptools-12.0.5\setuptools\compat.py",
 line 19, in 
from SimpleHTTPServer import SimpleHTTPRequestHandler
  File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in 
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  File "C:\Python27\lib\SimpleHTTPServer.py", line 214, in 
SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
  File "C:\Python27\lib\mimetypes.py", line 351, in init
db.read_windows_registry()
  File "C:\Python27\lib\mimetypes.py", line 254, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: must be string without null bytes or None, not str
Something went wrong during the installation.

--

___
Python tracker 

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



[issue23359] Speed-up set_lookkey()

2015-02-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thank Serhiy.  No early-out on insertion is possible.
For discard and contains, there is still no need for
testing dummies and tracking freeslots.

--

___
Python tracker 

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



[issue23370] PyBuffer_FromContiguous() off-by-one error for non-contiguous buffers

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 209776d49a9a by Stefan Krah in branch '2.7':
Issue #23370: Fix off-by-one error for non-contiguous buffers.
https://hg.python.org/cpython/rev/209776d49a9a

New changeset 4d95956a748e by Stefan Krah in branch '3.4':
Issue #23370: Fix off-by-one error for non-contiguous buffers.
https://hg.python.org/cpython/rev/4d95956a748e

--
nosy: +python-dev

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread SilentGhost

SilentGhost added the comment:

Raymond, but Alec talks about 

  defaultdict.fromkeys(constants, factory=list)

as opposed to current solution

  d = defaultdict.fromkeys(constants)
  d.default_factory = list
  for i in d:
  d[i] = []

I wouldn't think that the dict.fromkeys should be affected by this issue.

--

___
Python tracker 

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



[issue23370] PyBuffer_FromContiguous() off-by-one error for non-contiguous buffers

2015-02-01 Thread Stefan Krah

Changes by Stefan Krah :


--
status: open -> closed

___
Python tracker 

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



[issue23370] PyBuffer_FromContiguous() off-by-one error for non-contiguous buffers

2015-02-01 Thread Stefan Krah

Changes by Stefan Krah :


--
resolution:  -> fixed
stage: needs patch -> resolved

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread Alec Nikolas Reiter

Alec Nikolas Reiter added the comment:

@SilentGhost I was playing with a voting algorithm (Instant Runoff, rather than 
traditional majority). Ultimately, I ended up using Counter in place of a 
defaultdict, but that's how I ended up noticing it.

Not so much ensuring the content so much as setting an initial default state to 
mutate.

@rhettinger I had considered a comprehension and passing it into a defaultdict 
(or Counter) to get that nice missing key handling.

Implicitly assigning the factory is a pretty good compromise, like I said 
fromkeys accepting the factory would be a nice convenience rather than 
correcting a major oversight.

--

___
Python tracker 

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



[issue23359] Speed-up set_lookkey()

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are more ideas. I would probe to use set_lookkey_dummy_ignored() with 
following set_find_free_slot() (from set_faster_copy_2.patch in issue23290) if 
former hadn't find a key. If set hash == -1 for key == NULL, we can use only 
one comparison for testing key == NULL || key == dummy.

--

___
Python tracker 

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



[issue12916] Add inspect.splitdoc

2015-02-01 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Martin, you reused my own patch for this issue?

--

___
Python tracker 

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



[issue23352] Document "suboffsets if needed" in 2.7

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c4c1d68b6301 by Stefan Krah in branch '2.7':
Issue #23352: Document that Py_buffer.suboffsets must be NULL if no suboffsets
https://hg.python.org/cpython/rev/c4c1d68b6301

New changeset de5c8ee002bf by Stefan Krah in branch '3.4':
Issue #23352: Document that Py_buffer.suboffsets must be NULL if no suboffsets
https://hg.python.org/cpython/rev/de5c8ee002bf

New changeset 5d097a74766f by Stefan Krah in branch 'default':
Issue #23352: Merge from 3.4.
https://hg.python.org/cpython/rev/5d097a74766f

--
nosy: +python-dev

___
Python tracker 

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



[issue23372] defaultdict.fromkeys should accept a callable factory

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It may be written simpler:

d = defaultdict(factory)
for i in constants:
d[i]

or

d = defaultdict(factory, {i: factory() for i in constants})

I'm inclined to reject this proposition. It serves very special use case.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please look at the patch Stefan?

--

___
Python tracker 

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



[issue23371] mimetypes initialization fails on Windows because of TypeError

2015-02-01 Thread Steve Dower

Steve Dower added the comment:

Definitely a dup, though I don't have the number handy. There's a patch on the 
other issue waiting for a mimetypes maintainer to step up.

--

___
Python tracker 

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



[issue23371] mimetypes initialization fails on Windows because of TypeError

2015-02-01 Thread Tim Golden

Tim Golden added the comment:

It's right there on my to-do list which is, unfortunately, not getting 
any shorter.

TJG

On 01/02/2015 19:10, Steve Dower wrote:
>
> Steve Dower added the comment:
>
> Definitely a dup, though I don't have the number handy. There's a patch on 
> the other issue waiting for a mimetypes maintainer to step up.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Skip Montanaro

New submission from Skip Montanaro:

I'm probably doing something wrong, but I've tried everything I can think of
without any success.

In Python 2.7, the pydoc command successfully displays help for the sqlite3
package, though it muffs the output of Gerhard Häring's name, spitting out
the original Latin-1 spelling. In Python 3.x, I get a UnicodeEncodeError for
my trouble, and it hoses my tty settings to boot, requiring a LF reset LF
sequence to put right unless I set PAGER to "cat".

Here's a sample run:

% PAGER=cat pydoc3.5 sqlite3
Traceback (most recent call last):
  File "/Users/skip/local/bin/pydoc3.5", line 5, in 
pydoc.cli()
  File "/Users/skip/local/lib/python3.5/pydoc.py", line 2591, in cli
help.help(arg)
  File "/Users/skip/local/lib/python3.5/pydoc.py", line 1874, in help
elif request: doc(request, 'Help on %s:', output=self._output)
  File "/Users/skip/local/lib/python3.5/pydoc.py", line 1612, in doc
pager(render_doc(thing, title, forceload))
  File "/Users/skip/local/lib/python3.5/pydoc.py", line 1412, in pager
pager(text)
  File "/Users/skip/local/lib/python3.5/pydoc.py", line 1428, in 
return lambda text: pipepager(text, os.environ['PAGER'])
  File "/Users/skip/local/lib/python3.5/pydoc.py", line 1455, in pipepager
pipe.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 
600: ordinal not in range(128)

I understand the error, but I see no way to convince it to use any codec
other than "ascii".  Stuff I tried:

* setting PYTHONIOENCODING to "UTF-8" (suggested by Peter Otten on c.l.py)
* setting LANG to "en_US.utf8"

This is on a Mac running Yosemite with pydoc invoked in Apple's Terminal
app. Display is fine in my browser when I run pydoc as a web server.

The source it is attempting to display has a coding cookie, so it should
know that the code is encoded using Latin-1. The problem seems to all be
about generating output.

--
components: Library (Lib)
messages: 235200
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: pydoc 3.x raises UnicodeEncodeError on sqlite3 package
type: crash
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What are sys.getfilesystemencoding(), locale.getpreferredencoding(False), 
os.popen('cat', 'w').encoding?

--
nosy: +serhiy.storchaka

___
Python tracker 

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




[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Skip Montanaro

Skip Montanaro added the comment:

Without setting any environment variables:

>>> import sys
>>> sys.getfilesystemencoding()
'utf-8'
>>> import locale
>>> locale.getpreferredencoding(False)
'US-ASCII'
>>> import os
>>> os.popen('cat', 'w').encoding
'US-ASCII'

If I set PYTHONIOENCODING=UTF-8:

>>> import sys, locale, os
>>> sys.getfilesystemencoding()
'utf-8'
>>> locale.getpreferredencoding(False)
'US-ASCII'
>>> os.popen('cat', 'w').encoding
'US-ASCII'

If I set LANG=en_US.utf8:

>>> import sys, locale, os
>>> sys.getfilesystemencoding()
'utf-8'
>>> locale.getpreferredencoding(False)
'US-ASCII'
>>> os.popen('cat', 'w').encoding
'US-ASCII'

It appears neither of these environment variables does much in my environment.

I should point out that I just updated to Mac OS X 10.10.2 a couple
days ago. I have no idea if this problem existed before that upgrade.
Realizing that perhaps something had changed in the underlying
operating system support, I rebuilt Python 2.6 through 3.5 from
scratch. Same result.

--

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Skip Montanaro

Skip Montanaro added the comment:

Peter Otten posted a solution on c.l.py. The issue is that I didn't
mix my case properly when setting LANG:

hgpython% LANG=en_US.UTF-8 python3.5 -c 'import locale;
print(locale.getpreferredencoding(False))'
UTF-8
hgpython% LANG=en_US.utf8 python3.5 -c 'import locale;
print(locale.getpreferredencoding(False))'
US-ASCII

--

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Skip Montanaro

Skip Montanaro added the comment:

On Sun, Feb 1, 2015 at 2:19 PM, Skip Montanaro  wrote:
> The issue is that I didn't
> mix my case properly when setting LANG:

Actually, it's that the hyphen is required in "utf-8" or "UTF-8".

--

___
Python tracker 

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-01 Thread Stefan Krah

Stefan Krah added the comment:

[Slow internet connection, can't use Rietveld.]

CDataType_from_buffer():

I'm not that familiar with ctypes.  What is the high level goal here?
Allocate a chunk of memory, wrap it in a memoryview and have the
memoryview release that memory when its refcount is 0?

If so, I think we desperately need direct support for that in
memoryview.

--

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Skip Montanaro

Skip Montanaro added the comment:

Final note here. Peter also did a bit of digging. Here's his note about
what he found on c.l.py:

The pager is invoked by os.popen(), and after some digging I find that it
uses a io.TestIOWrapper() to write the help text. This in turn uses
locale.getpreferredencoding(False), i. e. you were right to set LANG and
PYTHONIOENCODING is not relevant.

I was also able to provoke this problem on an openSuSE 12.2 system with
3.2.3 installed. In that environment (confirmed by Chris Angelico on his
Linux system), the case of "utf" didn't matter, nor did it matter if
"utf-8" was hyphenated or not. Obviously the Mac continues to be a rather
touchy system w.r.t. locale.

I don't know if Python should try to be accommodating here, but my
inclination is "no". OTOH, maybe io.TestIOWrapper should look at
PYTHONIOENCODING, or the pager should be invoked through something other
than os.popen (assuming there is a suitable replacement which does pay
attention to PYTHONIOENCODING).

--

___
Python tracker 

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



[issue12916] Add inspect.splitdoc

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

Yes, this is based on your patch, Stéphane. On top of it I added support for 
splitdoc(None), and made the other changes in the bullet points.

--

___
Python tracker 

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



[issue23363] integer overflow in itertools.permutations

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23362] integer overflow in string translate

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23361] integer overflow in winapi_createprocess

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23365] integer overflow in itertools.combinations_with_replacement

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23367] integer overflow in unicodedata.normalize

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23364] integer overflow in itertools.product

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23366] integer overflow in itertools.combinations

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23368] integer overflow in _PyUnicode_AsKind

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2015-02-01 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

Maybe because a pager sends its bytes more-or-less straight throught from input 
to output, the PYTHONIOENCODING (sys.stdout.encoding?) should be used for the 
TextIOWrapper to the pager’s input in this case. I’m not so sure this should be 
assumed in general though.

--
nosy: +vadmium

___
Python tracker 

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



[issue22818] Deprecate splitting on possible zero-width re patterns

2015-02-01 Thread Ezio Melotti

Ezio Melotti added the comment:

DeprecationWarning: Base class for warnings about deprecated features.
UserWarning: Base class for warnings generated by user code.
RuntimeWarning: Base class for warnings about dubious runtime behavior.
FutureWarning: Base class for warnings about constructs that will change 
semantically in the future.

I think FutureWarning would be a good choice here, since we are going to change 
the semantics of a construct (before zero-width pattern didn't split -> in the 
future they will).

--

___
Python tracker 

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

_CData.from_buffer() is meant to take a writable buffer, and create a “ctypes” 
object that shares the same memory. So it should not release the buffer until 
that “ctypes” object is no longer needed.

However I don’t know the insides of memoryview() objects that well so I can’t 
say if the hack-the-memoryview code is correct or not.

--

___
Python tracker 

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

from_buffer() uses a memory buffer of other object. It keeps a reference to the 
object to prevent deallocation of memory when there will be no more external 
references. But this doesn't prevent from reallocating of memory of living 
object (e.g. for resizing of bytearray). So we need to grab the buffer (with 
PyObject_GetBuffer) in from_buffer() and free it (with PyBuffer_Release) when 
it is no longer needed. menoryview can do this but needs a hack, because a 
memoryview created by PyMemoryView_FromBuffer() doesn't release the buffer. May 
be there is more official way?

--

___
Python tracker 

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, Martin expressed the same thing better.

--

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-01 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +r.david.murray

___
Python tracker 

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8699b3085db3 by Benjamin Peterson in branch '3.3':
fix possible overflow in encode_basestring_ascii (closes #23369)
https://hg.python.org/cpython/rev/8699b3085db3

New changeset 4f47509d7417 by Benjamin Peterson in branch '3.4':
merge 3.3 (#23369)
https://hg.python.org/cpython/rev/4f47509d7417

New changeset 02aeca4974ac by Benjamin Peterson in branch 'default':
merge 3.4 (#23369)
https://hg.python.org/cpython/rev/02aeca4974ac

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue22623] Missing guards for some POSIX functions

2015-02-01 Thread Link Mauve

Changes by Link Mauve :


Removed file: http://bugs.python.org/file36898/f3cf19e38efe.diff

___
Python tracker 

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



[issue22623] Missing guards for some POSIX functions

2015-02-01 Thread Link Mauve

Link Mauve added the comment:

This issue is still present in latest 3.5, all the way down to 2.7.

--
components: +Extension Modules -Build
versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file37971/guards.diff

___
Python tracker 

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



[issue23373] curses.textpad crashes in insert mode on wide window

2015-02-01 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report. This is a duplicate of issue 13051. The insert_mode 
parameter was committed in issue 1048820.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Infinite recursion in curses.textpad.Textbox
type: crash -> behavior

___
Python tracker 

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



[issue23366] integer overflow in itertools.combinations

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 014886dae5c4 by Benjamin Peterson in branch '3.3':
detect overflow in combinations (closes #23366)
https://hg.python.org/cpython/rev/014886dae5c4

New changeset 2f73de7ffcf5 by Benjamin Peterson in branch '3.4':
merge 3.3 (#23366)
https://hg.python.org/cpython/rev/2f73de7ffcf5

New changeset 886559229911 by Benjamin Peterson in branch 'default':
merge 3.4 (#23366)
https://hg.python.org/cpython/rev/886559229911

New changeset fe203370c049 by Benjamin Peterson in branch '2.7':
detect overflow in combinations (closes #23366)
https://hg.python.org/cpython/rev/fe203370c049

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23365] integer overflow in itertools.combinations_with_replacement

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 93d445cd5f70 by Benjamin Peterson in branch '3.3':
check for overflow in combinations_with_replacement (closes #23365)
https://hg.python.org/cpython/rev/93d445cd5f70

New changeset 2e7a02e4cf2c by Benjamin Peterson in branch '3.4':
merge 3.3 (#23365)
https://hg.python.org/cpython/rev/2e7a02e4cf2c

New changeset 4d875a690c01 by Benjamin Peterson in branch 'default':
merge 3.4 (#23365)
https://hg.python.org/cpython/rev/4d875a690c01

New changeset 366018a91457 by Benjamin Peterson in branch '2.7':
check for overflow in combinations_with_replacement (closes #23365)
https://hg.python.org/cpython/rev/366018a91457

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue16632] Enable DEP and ASLR

2015-02-01 Thread Ricky Zhou

Ricky Zhou added the comment:

Sorry to revive this old bug, but would it be possible to get ASLR/DEP for 
windows on the 2.7 branch as well?

Also, re Christian's comment about DEP being disabled if a single libray 
doesn't support it - are you sure that's the case? I'm very new to windows 
stuff, but the only information about this I saw online was 
http://0xdabbad00.com/2012/12/07/dep-data-execution-prevention-explanation/, 
which says that only /NXCOMPAT on the EXE matters.

--
nosy: +ricky

___
Python tracker 

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



[issue23360] Content-Type when sending data with urlopen()

2015-02-01 Thread Martin Panter

Martin Panter added the comment:

Updated patch to explain that a Request object is generated internally for 
urlopen(data=...), and added a test to confirm. Also removed some confusing 
dead code.

--
Added file: http://bugs.python.org/file37972/non-urlencoded.2.patch

___
Python tracker 

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



[issue23364] integer overflow in itertools.product

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7133582b6769 by Benjamin Peterson in branch '3.3':
check for overflows in permutations() and product() (closes #23363, closes 
#23364)
https://hg.python.org/cpython/rev/7133582b6769

New changeset 9ae055c3db32 by Benjamin Peterson in branch '3.4':
merge 3.3 (#23364, #23363)
https://hg.python.org/cpython/rev/9ae055c3db32

New changeset 31dc5a40d2ab by Benjamin Peterson in branch 'default':
merge 3.4 (#23364, #23363)
https://hg.python.org/cpython/rev/31dc5a40d2ab

New changeset acc2c3479f2e by Benjamin Peterson in branch '2.7':
check for overflows in permutations() and product() (closes #23363, closes 
#23364)
https://hg.python.org/cpython/rev/acc2c3479f2e

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23363] integer overflow in itertools.permutations

2015-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7133582b6769 by Benjamin Peterson in branch '3.3':
check for overflows in permutations() and product() (closes #23363, closes 
#23364)
https://hg.python.org/cpython/rev/7133582b6769

New changeset 9ae055c3db32 by Benjamin Peterson in branch '3.4':
merge 3.3 (#23364, #23363)
https://hg.python.org/cpython/rev/9ae055c3db32

New changeset 31dc5a40d2ab by Benjamin Peterson in branch 'default':
merge 3.4 (#23364, #23363)
https://hg.python.org/cpython/rev/31dc5a40d2ab

New changeset acc2c3479f2e by Benjamin Peterson in branch '2.7':
check for overflows in permutations() and product() (closes #23363, closes 
#23364)
https://hg.python.org/cpython/rev/acc2c3479f2e

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23254] Document how to close the TCPServer listening socket

2015-02-01 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review

___
Python tracker 

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



  1   2   >