[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes the issue.

--
keywords: +patch
nosy: +serhiy.storchaka
stage:  -> patch review
Added file: 
http://bugs.python.org/file46402/inspect_argtuple_unpack_cellvars.patch

___
Python tracker 

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



[issue29357] New NamedTuple syntax silently ignores method definitions

2017-01-23 Thread Elazar Gershuni

New submission from Elazar Gershuni:

The following does not work as expected:
```
from typing import NamedTuple

class A(NamedTuple):
a: int

def __repr__(self):
return 'some A'

def spam(self):
print('spam!')

>>> a = A(5)
>>> repr(a)  # should be 'some A'
'A(a=5)'
>>> a.spam()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'A' object has no attribute 'spam'
```

--
components: Library (Lib)
messages: 286147
nosy: elazar, gvanrossum, rhettinger
priority: normal
severity: normal
status: open
title: New NamedTuple syntax silently ignores method definitions
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b74a6a7d4389 by Serhiy Storchaka in branch 'default':
Issue #29338: Fix test_enum.
https://hg.python.org/cpython/rev/b74a6a7d4389

--

___
Python tracker 

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



[issue29273] test___all__ alters utf8 locale setting

2017-01-23 Thread Martin Panter

Changes by Martin Panter :


--
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



[issue29182] Remove the warning in urllib docs that it doesn't do certificate validate by default.

2017-01-23 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Here is the updated patch that addresses the comment.

--
Added file: http://bugs.python.org/file46401/issue29182_docs_fix.patch

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Emily Morehouse

Changes by Emily Morehouse :


--
nosy: +emilyemorehouse

___
Python tracker 

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



[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError

2017-01-23 Thread Emily Morehouse

Emily Morehouse added the comment:

Yury, thanks for the encouragement to continue on this patch. I think it will 
be a good exercise to dive a bit deeper into Python's bytecode and put some 
knowledge to use.

I believe that tuple argument unpacking is handled appropriately, but there is 
an even further edge case where a closure is introduced. In the following, 
inspect.getargspec works for the first bit of code, but the second fails, as 
'a' is referenced outside of scope.

>>> dis.dis(lambda (a,): lambda x: x)
  1   0 LOAD_FAST0 (.0)
  3 UNPACK_SEQUENCE  1
  6 STORE_FAST   1 (a)
  9 LOAD_CONST   1 ( at 
0x10087a130, file "", line 1>)
 12 MAKE_FUNCTION0
 15 RETURN_VALUE
>>> dis.dis(lambda (a,): lambda x: a)
  1   0 LOAD_FAST0 (.0)
  3 UNPACK_SEQUENCE  1
  6 STORE_DEREF  0 (a)
  9 LOAD_CLOSURE 0 (a)
 12 BUILD_TUPLE  1
 15 LOAD_CONST   1 ( at 
0x10087a930, file "", line 1>)
 18 MAKE_CLOSURE 0
 21 RETURN_VALUE

I'll keep poking at this and see where I get.

-- EM

--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2017-01-23 Thread Xiang Zhang

Xiang Zhang added the comment:

I don't mean to sync the docstring and the documentation totally. But just like 
os.chown, there are some functions explicitly mention the acceptable types of 
path parameter in their docstrings. I think since they already mention the 
types, then make the list complete. For example, I think for os.chown make the 
list "can be string, bytes, path-like object or open-file-descriptor int" is 
enough.

--

___
Python tracker 

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



[issue29189] Broken indentation in FancyURLopener documentation

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb2885f9b4dd by Martin Panter in branch '2.7':
Issue #29189: Fix indentation in RST markup
https://hg.python.org/cpython/rev/fb2885f9b4dd

New changeset 75e341d79c99 by Martin Panter in branch '3.5':
Issue #29189: Fix indentation in RST markup
https://hg.python.org/cpython/rev/75e341d79c99

New changeset f0854405c830 by Martin Panter in branch '3.6':
Issues #29189: Merge indentation fixes from 3.5
https://hg.python.org/cpython/rev/f0854405c830

New changeset d654b7c63b48 by Martin Panter in branch 'default':
Issues #29189: Merge indentation fixes from 3.6
https://hg.python.org/cpython/rev/d654b7c63b48

--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2017-01-23 Thread Emily Morehouse

Emily Morehouse added the comment:

I see that path-like objects are indeed mentioned in the documentation 
(Doc/library/os.rst), simply stating "Changed in version 3.6: Supports a 
path-like object." Other methods, such as os.chroot, also mention such a change.

Comparing the docs mentioned above to the docstrings in 
Modules/clinic/posixmodule.c.h (and Modules/clinic/posixmodule.c for that 
matter), there's a clear disparity between the detail in the docs vs brevity in 
the docstrings (specifically in reference to os.chroot). 

Therefore, my question is: how detailed should the docstrings be and how 
closely should they match Doc/library/os.rst? I can certainly update the 
docstrings accordingly.

--
nosy: +emilyemorehouse

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Enum's interaction with the help subsystem has always been somewhat
fragile: http://bugs.python.org/issue18693

In this case, I think a reasonable quick fix would be to add the new text
to the expected output for enum instances (allowing this issue to be closed
again), and then file a separate issue about offering a way to omit that
text for types that discourage or don't allow dynamic creation of new
instances.

--

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is easy to fix the test by adding missed lines. But I'm not sure that output 
the (correct) signature of enum classes makes the help better.

Color(value, names=None, *, module=None, qualname=None, type=None, start=1)

Ethan, what are your thoughts?

--
nosy: +ethan.furman
resolution: fixed -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue24363] httplib fails to handle semivalid HTTP headers

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

Just a minor update with an extra get_payload() test I missed before

--
versions: +Python 3.7
Added file: http://bugs.python.org/file46400/policy-flag.v2.patch

___
Python tracker 

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



[issue28556] typing.py upgrades

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

ERROR: test_annotation_usage_with_methods (test.test_typing.NamedTupleTests)
--
Traceback (most recent call last):
  File "/home/proj/python/cpython/Lib/test/test_typing.py", line 2058, in 
test_annotation_usage_with_methods
self.assertEquals(XMeth(1).double(), 2)
  File "/home/proj/python/cpython/Lib/unittest/case.py", line 1311, in 
deprecated_func
DeprecationWarning, 2)
DeprecationWarning: Please use assertEqual instead.

--
nosy: +martin.panter

___
Python tracker 

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



[issue29349] Update old Python 2 code in Docs/tools/extensions/patchlevel.py

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

Is it okay to only fix this in 3.5+? 3.4 only gets security fixes now.

Either way, the “with” statement changes is not a bug fix and should only go 
into 3.7.

--
nosy: +martin.panter
stage:  -> commit review

___
Python tracker 

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



[issue29273] test___all__ alters utf8 locale setting

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 154757703c98 by Martin Panter in branch '3.5':
Issue #29273: Remove unneeded workaround to restore locale
https://hg.python.org/cpython/rev/154757703c98

New changeset 146f7ec82f93 by Martin Panter in branch '3.6':
Issues #29273: Merge test___all__ from 3.5
https://hg.python.org/cpython/rev/146f7ec82f93

New changeset 1615898492a6 by Martin Panter in branch 'default':
Issues #29273: Merge test___all__ from 3.6
https://hg.python.org/cpython/rev/1615898492a6

--
nosy: +python-dev

___
Python tracker 

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



[issue29356] TypeError by typing for Ellipsis

2017-01-23 Thread Ádám Szieberth

New submission from Ádám Szieberth:

I would expect Ellipsis the same behavior as None in type hints instead of:

TypeError: Union[arg, ...]: each arg must be a type. Got Ellipsis.

... would be much nicer than type(...) there.

--
messages: 286134
nosy: Ádám Szieberth
priority: normal
severity: normal
status: open
title: TypeError by typing for Ellipsis
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29347] Python 2.7.8 is crashing while creating weakref for a given object.

2017-01-23 Thread Saida Dhanavath

Saida Dhanavath added the comment:

Hi Christian Heimes,


Please ignore typos in the previous post. I have written some code to simulate 
and test PyWeakReference struct instantiation and then hit segfault based on 
the flag passed to C code. Here I am trying to execute some of the operations 
from new_weakref and dealloc_weakref of Objects/weakrefobject.c to show that 
new instance of PyWeakReference is not initialized properly and results in 
segfault. Have also checked python 3.6.0 source and I do not see any change in 
weakref alloc and dealloc routines of 2.7.8 and 3.6.0 versions. Have run test 
code on 2.7.8, 2.7.12+, 3.4m and 3.5m interpreters and got segfault in all runs.


Please find the sample output as given below.

ubuntu@ubuntu1610saida:~/weakref$ make build PYVERSION=2.7
swig -python weakref_crash.i
gcc -w -fpic -c weakref_crash.c weakref_crash_wrap.c -I/usr/include/python2.7
gcc -shared weakref_crash.o weakref_crash_wrap.o -o _pyweakref_crash.so 
-L/usr/lib/python2.7 -lpython2.7

ubuntu@ubuntu1610saida:~/weakref$ python test.py 0 0
2.7.12+ (default, Sep 17 2016, 12:08:02) 
[GCC 6.2.0 20160914]
0
0

ubuntu@ubuntu1610saida:~/weakref$ python test.py 0 1
2.7.12+ (default, Sep 17 2016, 12:08:02) 
[GCC 6.2.0 20160914]
0
0

ubuntu@ubuntu1610saida:~/weakref$ python test.py 1 0
2.7.12+ (default, Sep 17 2016, 12:08:02) 
[GCC 6.2.0 20160914]
1010101
1010101

ubuntu@ubuntu1610saida:~/weakref$ python test.py 1 1
2.7.12+ (default, Sep 17 2016, 12:08:02) 
[GCC 6.2.0 20160914]
1010101
1010101
Segmentation fault (core dumped)

ubuntu@ubuntu1610saida:~/weakref$ make clean
rm -f *.so *.o *crash.py *.pyc *crash_wrap.c

ubuntu@ubuntu1610saida:~/weakref$ make build PYVERSION=3.5m
swig -python weakref_crash.i
gcc -w -fpic -c weakref_crash.c weakref_crash_wrap.c -I/usr/include/python3.5m
gcc -shared weakref_crash.o weakref_crash_wrap.o -o _pyweakref_crash.so 
-L/usr/lib/python3.5m -lpython3.5m
ubuntu@ubuntu1610saida:~/weakref$ python3.5m test.py 0 0
3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927]
0
0
ubuntu@ubuntu1610saida:~/weakref$ python3.5m test.py 0 1
3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927]
0
0
ubuntu@ubuntu1610saida:~/weakref$ python3.5m test.py 1 0
3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927]
1010101
101
ubuntu@ubuntu1610saida:~/weakref$ python3.5m test.py 1 1
3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927]
1010101
101
Segmentation fault (core dumped)

--

___
Python tracker 

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



[issue29343] sock.close() raises OSError EBADF when socket's fd is closed

2017-01-23 Thread Yury Selivanov

Yury Selivanov added the comment:

Christian, how did you find this (i.e. what module/package is broken because of 
this)?  I'm still not entirely sure that raising EBADF in socket.close() is a 
good thing.

--
nosy: +yselivanov

___
Python tracker 

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



[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError

2017-01-23 Thread Yury Selivanov

Yury Selivanov added the comment:

Hi Emily!  Python 2.7 is in a maintenance-only mode at this point and mostly 
receives security-related patches.  The problem with accepting other kind of 
patches is that we want 2.7 to be super stable.

You can continue working on this bug anyways, once the patch is ready we'll 
have to ask Benjamin Peterson (Python 2.7 release manager) to review it.

I suspect the bug is that inspect.getargspec doesn't fully support tuple 
arguments unpacking (it's a rather obscure feature that we removed from Python 
3).

--

___
Python tracker 

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



[issue29355] sqlite3: remove sqlite3_stmt_readonly()

2017-01-23 Thread Ma Lin

New submission from Ma Lin:

In CPython 3.6.0, sqlite3 module uses sqlite3_stmt_readonly(), however this 
function is only available on SQLite 3.7.4+ (release on 2010-12-07).
Then CPython 3.6.0 can not be compiled on RHEL6 (with SQLite 3.6.x), 
complaints: issue29098, issue29325.

sqlite3_stmt_readonly() was introduced in 284676cf2ac8, it was used twice 
[1][2], but it seems that we can avoid using this function in both of them.

[1] https://hg.python.org/cpython/file/3.6/Modules/_sqlite/cursor.c#l517
With palaviv's patches of issue28518, we can eliminate sqlite3_stmt_readonly() 
in here.

[2] https://hg.python.org/cpython/file/3.6/Modules/_sqlite/cursor.c#l612
We can use the old way in here, the old way is even better IMO.

This issue depends on issue28518.

--
components: Library (Lib)
messages: 286130
nosy: Ma Lin, berker.peksag, palaviv
priority: normal
severity: normal
status: open
title: sqlite3: remove sqlite3_stmt_readonly()
type: enhancement
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2017-01-23 Thread Martin Panter

Changes by Martin Panter :


Added file: http://bugs.python.org/file46399/expressions-py3.7_v17.diff

___
Python tracker 

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



[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError

2017-01-23 Thread Emily Morehouse

Emily Morehouse added the comment:

Aspiring contributor here!

I believe I have narrowed this error down to the inspect module, specifically 
in the for loop beginning on line 759. 

There's a bit of "acrobatics" (to quote the code comments) that I'm trying to 
sift through, I've been using the getargspec method from the inspect module as 
well as print statements in the inspect module to narrow down the error. It 
definitely doesn't seem like the previously mentioned for loop is functioning 
properly, as the first item in the stack is being referenced when it is empty. 
Additionally, I'm utilizing the dis module to help make sense of the full code 
object to compare against the behavior in the for loop.

Yury, I've respectfully included you here as you're listed as the expert for 
the inspect module. I would really like to submit a patch for this, but may 
need a nudge in the right direction. I will update here with my progress.

--
nosy: +emilyemorehouse, yselivanov

___
Python tracker 

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

Updated patch for 2.7, which I plan to commit soon. Corresponding Py 3 patch 
coming soon.

--
Added file: http://bugs.python.org/file46398/expressions-py2.7_v17.diff

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Xiang Zhang

Xiang Zhang added the comment:

Things doesn't come to an end. :-( The enum test suite also gets a related test 
and make the buildbot fail:

FAIL: test_pydoc (test.test_enum.TestStdLib)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_enum.py", line 
2409, in test_pydoc
self.assertEqual(result, expected_text)
AssertionError: 'Help[68 chars]n |  Color(value, names=None, *, module=None, 
[896 chars]ing.' != 'Help[68 chars]n |  An enumeration.\n |  \n |  Method 
resolut[809 chars]ing.'
  Help on class Color in module test.test_enum:
  
  class Color(enum.Enum)
-  |  Color(value, names=None, *, module=None, qualname=None, type=None, 
start=1)
-  |  
   |  An enumeration.
   |  
   |  Method resolution order:
   |  Color
   |  enum.Enum
   |  builtins.object
   |  
   |  Data and other attributes defined here:
   |  
   |  blue = 
   |  
   |  green = 
   |  
   |  red = 
   |  
   |  --
   |  Data descriptors inherited from enum.Enum:
   |  
   |  name
   |  The name of the Enum member.
   |  
   |  value
   |  The value of the Enum member.
   |  
   |  --
   |  Data descriptors inherited from enum.EnumMeta:
   |  
   |  __members__
   |  Returns a mapping of member name->value.
   |  
   |  This mapping lists all enum members, including aliases. Note that this
   |  is a read-only view of the internal mapping.

--

___
Python tracker 

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



[issue21272] use _sysconfigdata to itinialize distutils.sysconfig

2017-01-23 Thread Martin Panter

Changes by Martin Panter :


--
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue29353] Incorrect handling of HTTP response with "Content-Type: message/rfc822" header

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

There is an inconsistency when parsing with headersonly=True. According to the 
documentation, get_payload() with message/rfc822 should should return a list of 
Message objects, not a string. But using headersonly=True produces a 
non-multipart Message object:

>>> m = Parser().parsestr("Content-Type: message/rfc822\r\n\r\n", 
>>> headersonly=True)
>>> m.get_content_type()
'message/rfc822'
>>> m.is_multipart()  # Doc says True
False
>>> m.get_payload()  # Doc says list of Message objects
''

Related to this, setting headersonly=True can also cause a internal 
inconsistency. Maybe this is why it was called a “hack”:

>>> Parser().parsestr("Content-Type: message/delivery-status\r\nInvalid 
>>> line\r\n\r\n", headersonly=True).as_string()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/email/message.py", line 159, in as_string
g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python3.5/email/generator.py", line 115, in flatten
self._write(msg)
  File "/usr/lib/python3.5/email/generator.py", line 181, in _write
self._dispatch(msg)
  File "/usr/lib/python3.5/email/generator.py", line 214, in _dispatch
meth(msg)
  File "/usr/lib/python3.5/email/generator.py", line 331, in 
_handle_message_delivery_status
g.flatten(part, unixfrom=False, linesep=self._NL)
  File "/usr/lib/python3.5/email/generator.py", line 106, in flatten
old_msg_policy = msg.policy
AttributeError: 'str' object has no attribute 'policy'

I think it may be best only change get_payload() to return a string in the next 
Python version (3.7), with appropriate documentation updates. For existing 
Python versions, perhaps urllib3 could check if the list returned by 
get_payload() only has trivial empty Message objects (no header fields and only 
empty payloads themselves).

If we agree that only a feature change for 3.7 is appropriate, there are other 
problems with the current parsing of HTTP headers that could also be looked at:

* Only a blank line should end a header section (Issue 24363, Issue 26686)
* “From” line should be a defect
* Use “email” package’s HTTP parsing policy
* Don’t assume Latin-1 encoding (Issue 27716)
* Avoid double-handling (header lines are parsed in http.client, then joined 
together and parsed again in email.feedparser)

--
components: +email
nosy: +barry, martin.panter
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread 12345 67890

12345 67890 added the comment:

In addition, windows allows direct console control via the win32 API and the 
code for that isn't too lengthy.

--

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread 12345 67890

12345 67890 added the comment:

It probably won't be trivial, but it definitely is possible. Suplemon has the 
exact functionality needed and it's only dependency is CPython. The only 
question is: how much code is this going to add?

[1]: https://github.com/richrd/suplemon

--

___
Python tracker 

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



[issue29228] sqlite3 OperationalError on changing into WAL transaction mode

2017-01-23 Thread Aviv Palivoda

Aviv Palivoda added the comment:

There is also a issue with the docs here. Look at issue 29121.

--
nosy: +palaviv

___
Python tracker 

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



[issue28518] execute("begin immediate") throwing OperationalError

2017-01-23 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Removed opening a transaction on select. I will argue for that in issue 9924 
after this is resolved.

--
Added file: http://bugs.python.org/file46397/sqlite-ddl-dml-3.patch

___
Python tracker 

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



[issue29343] sock.close() raises OSError EBADF when socket's fd is closed

2017-01-23 Thread Charles-François Natali

Charles-François Natali added the comment:

FWIW I agree with Antoine and Martin: ignoring EBADF is a bad idea,
quite dangerous.
The man page probably says this to highlight that users shouldn't
*retry* close():
"""
   Retrying the close() after a failure return is the wrong thing to do,
   since this may cause a reused file descriptor from another thread to
   be closed.  This can occur because the Linux kernel always releases
   the file descriptor early in the close operation, freeing it for
   reuse; the steps that may return an error, such as flushing data to
   the filesystem or device, occur only later in the close operation.

"""

(Including on EINTR).

In short, I think that the change is a good idea: Socket.close() is
guaranteed to be idempotent, so this error can only happen in case of
invalid usage.

--

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-23 Thread Michael Felt

Michael Felt added the comment:

You guys are the experts. I can only comment on what I see. IMHO: the file 
_sysconfigdata.py is more accurate with nothing in it.

I am clearly confused by whatever process this is. If you believe it is more 
accurate to have the BLD variable 'inaccurate' in this file - and that we just 
need to "believe" that it has the correct value during the build (which, 
starting with version 2.7.13 seems to be the case, as I am able to build in a 
different directory - and could not do this with version 2.7.10 (first time I 
tried using separate directories).

In short, I have no expert opinion on this. My naive view is that both 
variables being accurate in the file is more accurate. In any case, the patch 
is needed for a working _sysconfigdata.py and integration with something such 
as "pip build ...". Only after I learned about 'pip' did I ever run into this, 
i.e., only people who are trying to install something extra have issues here. I 
have been 'patching' _sysconfigdata.py manually so that things work normally.

I hope my feedback helps you move forward on this.

--

___
Python tracker 

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



[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError

2017-01-23 Thread Elias Vanderstuyft

New submission from Elias Vanderstuyft:

The following might be either a bug in the pydoc module or in the inspect 
module:

$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydoc
>>> pydoc.help(lambda (a,): lambda x: a)# this fails
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/pydoc.py", line 1797, in __call__
self.help(request)
  File "/usr/lib/python2.7/pydoc.py", line 1844, in help
else: doc(request, 'Help on %s:')
  File "/usr/lib/python2.7/pydoc.py", line 1581, in doc
pager(render_doc(thing, title, forceload))
  File "/usr/lib/python2.7/pydoc.py", line 1576, in render_doc
return title % desc + '\n\n' + text.document(object, name)
  File "/usr/lib/python2.7/pydoc.py", line 363, in document
if inspect.isroutine(object): return self.docroutine(*args)
  File "/usr/lib/python2.7/pydoc.py", line 1321, in docroutine
args, varargs, varkw, defaults = inspect.getargspec(object)
  File "/usr/lib/python2.7/inspect.py", line 817, in getargspec
args, varargs, varkw = getargs(func.func_code)
  File "/usr/lib/python2.7/inspect.py", line 791, in getargs
args[i] = stack[0]
IndexError: list index out of range
>>> pydoc.help(lambda (a,): lambda x: x)# this succeeds

>>>

--
components: Library (Lib)
messages: 286119
nosy: Elias Vanderstuyft
priority: normal
severity: normal
status: open
title: Python 2.7.12: pydoc.help(lambda (a,): lambda x: a) raises IndexError
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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The point I was trying to get at above is that simply printing a prompt and 
making the use enter the entire line should work on every console, while 
anything fancier may not be so reliable.  Thinking more, I realize that my 
patch outline is incomplete. After 'line = input(prompt + indent)', line will 
not include the indent. A printed indent will have to be added to the input 
received from the user.  (In IDLE's Shell and editors, the indents that IDLE 
insert()s into a text widget are indistinguishable from those types by a user 
and *are* included in the user input that IDLE reads.)  An associated issue is 
that cross-platform automated tests would be difficult to impossible.

More experiment reveals the fatal problem: in REPL mode, python reads stdin and 
writes to stdout and stderr.  In the Windows console, and I am sure others, 
printed output cannot be deleted.  In particular, printed input spaces, such as 
the one at the end of '>>> ' cannot be deleted.  So dedenting, as in the 
following example, would not be possible.  One cannot input() a negative string.

if possible:
print('I like it')
write_patch()
test()
else:
print('too bad')
reject_idea()

So unless I am wrong, the idea must be rejected.

--
stage:  -> needs patch
versions: +Python 3.7

___
Python tracker 

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



[issue29152] unittest subTest does not call addFailure

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

It is not obvious what the effect of not calling addFailure() is, but perhaps 
this is related to Issue 25894? Failure and error statuses are not immediately 
reported from subtests.

--
nosy: +martin.panter

___
Python tracker 

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



[issue29347] Python 2.7.8 is crashing while creating weakref for a given object.

2017-01-23 Thread Saida Dhanavath

Saida Dhanavath added the comment:

Hi Christian Heimes,


PFA. I have written a some code to simulate and test PyWeakReference struct 
instantion and then hit segfault based on flag passed-in to C code. Here I am 
trying to execute some of the operations from new_weakref and dealloc_weakref 
of Objects/weakrefobject.c to show that new isntance of PyWeakReference is not 
initialized properly. Have also checked latest 3.6 source and there is no 
difference in alloc and dealloc routines of 2.7.8 and 3.6.0. Have run test code 
on 2.7.8, 2.7.12+, 3.4m and 3.5m interpreters and got segfault in all runs.

--
Added file: http://bugs.python.org/file46396/crash_in_weakref.zip

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-23 Thread David Edelsohn

David Edelsohn added the comment:

I completely agree with Martin's concern.  As I expressed before, this needs to 
work in three contexts:

1) Building modules in the tree during the build process.
2) In-tree testing of build module feature (test_distutils).
3) Building and installing modules with an installed version of Python.

--

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-23 Thread Martin Panter

Martin Panter added the comment:

If the assignment is completely removed, won’t this break the test when run 
from the source or build tree (as opposed to when installed)? Or at least make 
the situation worse: the AIX buildbot is already failing test_distutils, but at 
least it is looking for Modules/ld_so_aix locally rather than in the 
yet-to-be-installed location.

--

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Thanks for the standard explanation, Brett. I was just following the devguide 
too strictly and assumed python-ideas is the first place one should go :-).

As for the idea, it seems others wish/wished it too (first paragraph: 
https://docs.python.org/3/tutorial/interactive.html#alternatives-to-the-interactive-interpreter)

--

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Adding at least 'dumb indentation' (repeat last indent) to the REPL would make 
it at least a bit more usable.  (This still would not be a good as an IDE, like 
IDLE, that does smarter indentation, such as adding an additional indent after 
a compound statement header ends with ':'.)

The simplest patch would be to slice and echo the initial whitespace (spaces 
and tabs) of each line that needs to be followed with a secondary prompt.  What 
I don't know is whether, on every console, a printed tab always has the same 
effect as a tab entered by a user.
Testing would be needed.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Brett Cannon

Brett Cannon added the comment:

No, I don't think you were rude, 12345 67890. I was just giving the standard 
explanation as some people are not pleasant and you never know who might read 
this issue later and benefit from the reminder.

--

___
Python tracker 

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



[issue29353] Incorrect handling of HTTP response with "Content-Type: message/rfc822" header

2017-01-23 Thread R. David Murray

R. David Murray added the comment:

IMO http *should* be using headersonly=True, so while I haven't looked into 
this issue the solution seems plausible to me.  I'm not entirely sure why it is 
considered a backward-compatibility hack, but I don't see any likelyhood that 
the headersonly API will go way.

--
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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread 12345 67890

12345 67890 added the comment:

I hope I haven't been rude; the idea here was to see what the feeling of the 
core developers was about this idea.

As for the patch, that will probably come after the Python workflow has been 
fixed because doing it then will save everyone time and as I have said, this is 
low priority.

--

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Brett Cannon

Brett Cannon added the comment:

Posting an idea directly to the issue tracker is fine as long as it's done in a 
reasonable fashion (i.e. not rudely).

As for the specific idea, I assume this is for the REPL as used in a shell and 
not in IDLE. If you want to propose a patch that can work cross-platform in 
both a Windows and UNIX shell where dedenting works consistently then it might 
be considered.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue29337] BytesWarning at compile time

2017-01-23 Thread Brett Cannon

Brett Cannon added the comment:

LGTM

--
nosy: +brett.cannon

___
Python tracker 

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



[issue29353] Incorrect handling of HTTP response with "Content-Type: message/rfc822" header

2017-01-23 Thread brokenenglish

New submission from brokenenglish:

Hello.

I found a bug that causes incorrect handling of some values of "Content-Type" 
header. When you retrieve any URL with "Content-Type: message/rfc822" header, 
additional payload is added to HTTPMessage. In some cases it causes annoing 
warnings. Here is a code from packages requests and urllib3 that can cause 
warning output:
1. Checking and raising excpection in urllib3: 
https://github.com/shazow/urllib3/blob/0fb5e083b2adf7618db8c26e8e50206de09dd845/urllib3/util/response.py#L61-L66
2. The same code packaged in requests: 
https://github.com/kennethreitz/requests/blob/362da46e9a46da6e86e1907f03014384ab210151/requests/packages/urllib3/util/response.py#L61-L66
3. Logging the error to output: 
https://github.com/kennethreitz/requests/blob/362da46e9a46da6e86e1907f03014384ab210151/requests/packages/urllib3/connectionpool.py#L402-L407

The issue arises from the class email.feedparser.FeedParser that handles HTTP 
and email headers in the same way. So when it handles headers with the message 
with content-type "message/*" and some other, method _parsegen() tries to parse 
it like a message with another message (see comments to this condition: 
https://hg.python.org/cpython/file/tip/Lib/email/feedparser.py#l295). If 
headers-only argument is set to True, we can avoid some redundant checks on 
HTTP headers (see this condition: 
https://hg.python.org/cpython/file/tip/Lib/email/feedparser.py#l244).

I read the comment above 
(https://hg.python.org/cpython/file/tip/Lib/email/feedparser.py#l241) but I am 
a newbie and I don't see any other solution to my problem for now. I can 
rewrite the patch if you show me a better way to fix this issue.

A patch with the unit test is atached.

--
files: rfc822_httpmessage_payload.patch
keywords: patch
messages: 286106
nosy: brokenenglish
priority: normal
severity: normal
status: open
title: Incorrect handling of HTTP response with "Content-Type: message/rfc822" 
header
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46395/rfc822_httpmessage_payload.patch

___
Python tracker 

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



[issue26491] Defer DECREFs until enum object is in a consistent state for re-entrancy

2017-01-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> rhettinger
status: pending -> open

___
Python tracker 

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



[issue29167] Race condition in enum.py:_decompose()

2017-01-23 Thread Ethan Furman

Ethan Furman added the comment:

Fixed the race condition for both the RuntimeError and for getting duplicate 
composite members.

--
keywords: +patch
stage: test needed -> patch review
Added file: http://bugs.python.org/file46394/issue29167.stoneleaf.01.patch

___
Python tracker 

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



[issue29350] Add support of multiple signatures

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It can be do, but I don't think it is worth. Making bases and mapping optional 
arguments does not make much sense to me. And there is no a value that can be 
used as a default value for the second parameter in dict.pop().

--

___
Python tracker 

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



[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread Zach Riggle

Zach Riggle added the comment:

Neat, though that's not in the standard library.

The current logic for getting a handle to libc could also be simplified via 
ctypes.util.find_library 
(https://docs.python.org/3/library/ctypes.html#finding-shared-libraries).

Darwin:

>>> import ctypes.util
>>> ctypes.util.find_library('c')
'/usr/lib/libc.dylib'

Linux:

>>> import ctypes.util
>>> ctypes.util.find_library('c')
'libc.so.6'

--

___
Python tracker 

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



[issue29351] absolute imports for logging

2017-01-23 Thread Vinay Sajip

Vinay Sajip added the comment:

> No, we cannot consider these changes under any circumstances for 2.7 because 
> ...

Well, it would change import behaviour in a backwards-incompatible way, 
wouldn't it?

--

___
Python tracker 

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



[issue29350] Add support of multiple signatures

2017-01-23 Thread Yury Selivanov

Yury Selivanov added the comment:

Signature object provides methods like .bind(), which will be hard to define if 
a function has many signatures.  Also, inspect.signature currently returns one 
Signature object, that shouldn't be changed.

Wouldn't it be easier instead of this:
  type(obj)
  type(name, bases, mapping)

do this:
  type(obj_or_name, bases=None, mapping=None)

And explain what really is going on in the docstring?

--

___
Python tracker 

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



[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread STINNER Victor

STINNER Victor added the comment:

If you want crashes, look at the portable faulthandler._sigsegv() :-)

--

___
Python tracker 

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



[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread Zach Riggle

Zach Riggle added the comment:

Of note, there's no need to actually cause a SIGSEGV to generate the signal.

The tests might be more clear to replace:

libc.printf(ctypes.c_char_p(0xdeadbeef))

with

os.kill(os.getpid(), signal.SIGSEGV)

--

___
Python tracker 

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



[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences

2017-01-23 Thread Akira Li

New submission from Akira Li:

I've failed to find where the behavior for negative indices in s[i:j]
expression (i, j < -len(s)) for standard sequences (str, list, etc) is
formally defined.

The observed behavior implemented in PySlice_GetIndicesEx(): If "len(s)
+ i" or "len(s) + j" is negative, use 0. [1] I don't see it in the docs.

if (*start < 0) *start += length;
if (*start < 0) *start = (*step < 0) ? -1 : 0;
...
if (*stop < 0) *stop += length;
if (*stop < 0) *stop = (*step < 0) ? -1 : 0;

The tutorial mentions [2]:

> out of range slice indexes are handled gracefully when used for
> slicing"

slice.indices() documentation says [3]:

> Missing or out-of-bounds indices are handled in a manner consistent
> with regular slices.

Neither define it explicitly.

The behavior for the upper boundary is defined explicitly [4]:

> If *i* or *j* is greater than ``len(s)``, use ``len(s)``

I've added the documentation patch that defines the behavior for the
lower boundary too.

[1] Objects/sliceobject.c
[2] Doc/tutorial/introduction.rst
[3] Doc/reference/datamodel.rst
[4] Doc/library/stdtypes.rst

--
assignee: docs@python
components: Documentation
files: docs-negative-slice-indices.patch
keywords: patch
messages: 286098
nosy: akira, docs@python
priority: normal
severity: normal
status: open
title: provide the authorative source for s[i:j] negative slice indices 
(<-len(s)) behavior for standard sequences
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46393/docs-negative-slice-indices.patch

___
Python tracker 

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



[issue29351] absolute imports for logging

2017-01-23 Thread Markus Gerstel

Markus Gerstel added the comment:

Yes, this is indeed the same for other stdlib modules, too. Logging is just the 
first one that came to attention in our investigations.

I haven't prepared any other patches yet though, because your answer could 
easily be "No, we cannot consider these changes under any circumstances for 2.7 
because $reason".

--

___
Python tracker 

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



[issue29136] Add OP_NO_TLSv1_3

2017-01-23 Thread Christian Heimes

Christian Heimes added the comment:

No, of course it does not work (yet):

$ LD_LIBRARY_PATH=. apps/openssl ciphers TLS13
Error in cipher list
140546693477888:error:1410D0B9:SSL routines:SSL_CTX_set_cipher_list:no cipher 
match:ssl/ssl_lib.c:2100:

--

___
Python tracker 

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



[issue29136] Add OP_NO_TLSv1_3

2017-01-23 Thread Alex Gaynor

Alex Gaynor added the comment:

We can easily just add `TLS13:...` at the from of our ciphersuite list and 
it'll be ok though right? (Note to self, do the same in urllib3, twisted, 
requests, god only knows what else)

--
nosy: +alex

___
Python tracker 

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



[issue29351] absolute imports for logging

2017-01-23 Thread Vinay Sajip

Vinay Sajip added the comment:

There's nothing particular about logging here, is there? Any of the 2.7 stdlib 
modules will exhibit similar behaviour, since that __future__ import is not in 
general defined in the stdlib modules, other than in the test suite.

--

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch for longobject.c addresses Martin's comments.

--
Added file: http://bugs.python.org/file46392/clinic_longobject_v4.patch

___
Python tracker 

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



[issue28876] bool of large range raises OverflowError

2017-01-23 Thread Mark Dickinson

Mark Dickinson added the comment:

Latest patch LGTM too.

--

___
Python tracker 

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



[issue29346] datetime.utcfromtimestamp() returns strange result for very large values

2017-01-23 Thread Eli Collins

Eli Collins added the comment:

My apologies, I think Alexander is right, this is a duplicate of #29100

I'd seen the first message in that issue talking about a core dump, and thought 
this was different problem; but I see the scope of the issue broadened to cover 
general bounds issues in later messages. 

Reviewing the fix & the tests from that issue's patches, it looks like exactly 
this case.

--
resolution:  -> duplicate

___
Python tracker 

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



[issue29351] absolute imports for logging

2017-01-23 Thread Dries Desmet

Changes by Dries Desmet :


--
nosy: +dries_desmet

___
Python tracker 

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



[issue29351] absolute imports for logging

2017-01-23 Thread Markus Gerstel

Changes by Markus Gerstel :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread 12345 67890

12345 67890 added the comment:

I did not mark this as a bug. I marked it as an "enhancement" and I said that 
the priority was low.

"I'm not exactly sure what you mean"

In an IDE when developing in python, each time you press enter, the cursor is 
set to the same indentation level as the previous line so that you don't need 
to type spaces on every new line to return to the same indentation level. I am 
merely suggesting that the interactive interpreter do the same thing. 

"is more of a subjective opinion"

You are of course correct that this is a subjective opinion. But it's not just 
my subjective opinion. As I said, it's what nearly every IDE does including 
(maybe?) the one that you're using.

--

___
Python tracker 

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



[issue28876] bool of large range raises OverflowError

2017-01-23 Thread Akira Li

Akira Li added the comment:

I've updated the patch to use 4-space indent (pep-7).

I've added space around "=" (pep-7); unlike the usual
"dict(designator=value)" -- no space around "=" for keyword argument
(pep-8).

--
Added file: 
http://bugs.python.org/file46391/range_bool-c99-designated-initializers-indent.patch

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-23 Thread Michael Felt

Michael Felt added the comment:

This is "only" for Python-2.7 (for now). The others will be tested as I am able.

Working with the patch submitted 2013-10-19 (aka 
https://bugs.python.org/file32229/issue18235.patch)

A) Without/before the patch:

root@x064:[/data/prj/python/Python-2.7.13.0]grep LDSHARED 
./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',

B) Apply the patch:
diff -r 0a26ef834a49 Lib/sysconfig.py
--- a/Lib/sysconfig.py  Sat Oct 19 14:24:44 2013 +0200
+++ b/Lib/sysconfig.py  Sat Oct 19 11:46:10 2013 -0700
@@ -368,7 +368,7 @@
 # -- these paths are relative to the Python source, but when installed
 # the scripts are in another directory.
 if _PYTHON_BUILD:
-vars['LDSHARED'] = vars['BLDSHARED']
+vars['BLDSHARED'] = vars['LDSHARED']

After the patch:

root@x064:[/data/prj/python/Python-2.7.13.0]grep LDSHARED 
./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r 
-bI:/opt/lib/python2.7/config/python.exp',
 'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r 
-bI:/opt/lib/python2.7/config/python.exp',

Which makes me think - maybe NOTHING is needed - as 'BLDSHARED' should be 
Modules/ld_so_aix,
while  'LDSHARED' should be '/opt/lib/python2.7/config/ld_so_aix

Rather than actual deletes: commented out to (after patch was applied)

C: if: statement and assignment - commented out
diff -ru Python-2.7.13/Lib/sysconfig.py Python-2.7.13.0/Lib/sysconfig.py
--- Python-2.7.13/Lib/sysconfig.py  2016-12-17 20:05:06 +
+++ Python-2.7.13.0/Lib/sysconfig.py2017-01-23 14:39:31 +
@@ -310,8 +310,8 @@
 # On AIX, there are wrong paths to the linker scripts in the Makefile
 # -- these paths are relative to the Python source, but when installed
 # the scripts are in another directory.
-if _PYTHON_BUILD:
-vars['LDSHARED'] = vars['BLDSHARED']
+#if _PYTHON_BUILD:
+#vars['BLDSHARED'] = vars['LDSHARED']

root@x064:[/data/prj/python/Python-2.7.13.0]grep LDSHARED 
./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r 
-bI:/opt/lib/python2.7/config/python.exp',
root@x064:[/data/prj/python/Python-2.7.13.0]

So, perhaps the best patch 'today', versus what may have been best in 2013 - is 
to remove the 5 lines starting with # On AIX, ...

--

___
Python tracker 

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



[issue28518] execute("begin immediate") throwing OperationalError

2017-01-23 Thread Berker Peksag

Berker Peksag added the comment:

> 1. Should we add the VACUUM with a explicit commit? Maybe there should
> be an implicit commit before VACUUM?

VACUUM is often an expensive operation so I think people should need to 
explicitly handle it anyway.

> 2. Should a SELECT start a transaction? I think it should according to
> PEP 249. There is a open issue on the case (#9924). Should we just
> change this on this patch?

Let's discuss that in issue 9924 :) Last time I look at it there was some 
backward compatibility concern so we might able to fix it only in 3.7.

--

___
Python tracker 

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



[issue29325] pysqlite: Evaluate removal of sqlite3_stmt_readonly

2017-01-23 Thread Ma Lin

Ma Lin added the comment:

Just remind, there is a chance to remove sqlite3_stmt_readonly(). :)

--
nosy: +berker.peksag, palaviv

___
Python tracker 

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



[issue29152] unittest subTest does not call addFailure

2017-01-23 Thread kristall

kristall added the comment:

Thanks for the quick 1st response. Since I put that part of my script on hold, 
I'd like to ask if it is possible to estimate when Antoine will have a look at 
this? Thanks in advance.

--

___
Python tracker 

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



[issue28518] execute("begin immediate") throwing OperationalError

2017-01-23 Thread Ma Lin

Ma Lin added the comment:

If the answer is (no, no) , the behavior strictly follows the doc changes in 
commit 284676cf2ac8.
Anyway, I'm not a deep user of SQLite, I can't give further advices. :(

--

___
Python tracker 

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



[issue29351] absolute imports for logging

2017-01-23 Thread Markus Gerstel

New submission from Markus Gerstel:

Running 'import logging' causes at minimum 46 failing 'open' and 12 failing 
'stat' calls because python looks for packages inside python/Lib/logging which 
will never be there, in particular: sys, os, time, cStringIO, traceback, 
warnings, weakref, collections, codecs, thread, threading, atexit.

The impact of this is limited when python is installed locally, but noticeable 
when run on a networked file system.


How to reproduce: 
run 
$ strace python -c "import logging;" 2>&1 | grep ENOENT | grep "\/logging\/"


How to fix:
Add 'from __future__ import absolute_import' to all files in the logging 
directory.
A relevant patch is attached.

--
components: Library (Lib)
files: 0001-absolute-import.patch
keywords: patch
messages: 286083
nosy: mgerstel
priority: normal
severity: normal
status: open
title: absolute imports for logging
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file46390/0001-absolute-import.patch

___
Python tracker 

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



[issue29336] merge tuples in module

2017-01-23 Thread INADA Naoki

INADA Naoki added the comment:

Thanks.  Your patch reduced memory consumption by 2%,
and number of tuples by 15%.

$ cat invtuple.py
import app
import sys
import traceback
import tracemalloc

print(tracemalloc.get_traced_memory())
allobj = sys.getobjects(0, tuple)
print(len(allobj))

$ PYTHONTRACEMALLOC=1 venv/bin/python invtuple.py
(51491189, 51506311)
87143

$ PYTHONTRACEMALLOC=1 venv-mt/bin/python  invtuple.py
(50551519, 50566641)
74308

--

___
Python tracker 

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



[issue29212] Python 3.6 logging thread name regression with concurrent.future threads

2017-01-23 Thread INADA Naoki

INADA Naoki added the comment:

OK. I'll wait for another opinions.

--

___
Python tracker 

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



[issue29212] Python 3.6 logging thread name regression with concurrent.future threads

2017-01-23 Thread desbma

desbma added the comment:

I don't think using repr(self) as a fallback was intentional, that is why I 
wrote regression, but I may be wrong.

I agree that the previous default 'Thread-x' gives little information, but only 
the user can give a relevant name to describe what a thread is doing.
Using a new default like "ThreadPoolExecutor-worker_x" would give more 
information but at the same time it leaks internal information about how the 
thread was created in the code (which is not relevant when using the logging 
module), not about what it's doing.

Anyway as long as that repr string is replaced, I am happy :)

--

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I forgot to run tests for such simple change! Thanks for reminder Xiang!

--

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cebc9c7ad195 by Serhiy Storchaka in branch 'default':
Issue #29338: Don't output an empty signature for class constructor.
https://hg.python.org/cpython/rev/cebc9c7ad195

--

___
Python tracker 

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



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2017-01-23 Thread STINNER Victor

STINNER Victor added the comment:

> Patch looks good to me.

Oh, I forgot socket_doc.patch! Thanks Serhiy for the reminder and Martin for 
the review :-) I just pushed the patch.

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

___
Python tracker 

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



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ffb2534fcbf1 by Victor Stinner in branch '3.6':
Issue #26273: Document TCP_USER_TIMEOUT and TCP_CONGESTION
https://hg.python.org/cpython/rev/ffb2534fcbf1

--

___
Python tracker 

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



[issue28749] Fixed the documentation of the mapping codec APIs

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

"bytes ordinals" is good term. Thank you. Here is an updated patch.

> No, I'd prefer this deprecation to be undone as long as we
> don't have a proper alternative for the API.

This is different issue.

--
Added file: http://bugs.python.org/file46389/docs-PyUnicode_Translate-4.patch

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-01-23 Thread STINNER Victor

STINNER Victor added the comment:

Antoine Pitrou: "Benchmarks and Intel's recommendation show that aligned 
allocation is actually important for AVX performance, and NumPy depends on 
CPython providing the right allocation APIs (for integration with tracemalloc): 
https://github.com/numpy/numpy/issues/5312;

I don't think that NumPy was ever fully integrated with tracemalloc.

Since Python 3.6, NumPy doesn't have to use Python memory allocators to benefit 
of tracemalloc debugger: I added a new C API to be able to manually 
track/untrack memory blocks which are not directly allocated by Python, see the 
issue #26530. I implemented this feature for NumPy, but since I never got any 
feedback from NumPy, I left the API private.

Moreover, I also added second feature to tracemalloc: it's now possible to 
track memory allocation in different address spaces. The feature was also 
designed for NumPy which can allocate memory in the GPU address space. See the 
issue #26588.

With these new tracemalloc features, I don't think that NumPy can still be used 
to request this feature in CPython core.

--

Raymond: "A principal use case would be PyObject pointers where we want to keep 
all or most of the data fields in the same cache line (i.e. the fields for 
list, tuple, dict, and set objects).

Deques would benefit from having the deque blocks aligned to 64byte boundaries 
and never crossing page boundaries.  Set entries would benefit from 32byte 
alignment."

Victor (me!): "Do you have an idea of performance benefit of memory alignment?"

Since Raymond never provided any evidence that a new aligned memory allocator 
would give a significant speedup, and there issue is inactive for 2 years, I 
close it.

See also the change 6e16b0045cf1, it seems like Raymond doesn't plan to use 
this feature anymore.

--

If someone wants this feature, we need good reasons to implement it.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Xiang Zhang

Xiang Zhang added the comment:

The buildbots are failing due to test_pydoc. :-(

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue24379] Add operator.subscript as a convenience for creating slices

2017-01-23 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue28651] Make objects with empty __slots__ GC types

2017-01-23 Thread STINNER Victor

STINNER Victor added the comment:

This issue was mentioned in another issue when a refleak was found:

http://bugs.python.org/issue24379#msg280456

--
nosy: +haypo

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Raymond.

--
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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3d5dcdf26fab by Serhiy Storchaka in branch 'default':
Issue #29338: The help of a builtin or extension class now includes the
https://hg.python.org/cpython/rev/3d5dcdf26fab

--
nosy: +python-dev

___
Python tracker 

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



[issue26729] Incorrect __text_signature__ for sorted

2017-01-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0a9fb3e19b9 by Serhiy Storchaka in branch '3.5':
Issue #26729: Fixed __text_signature__ for sorted().
https://hg.python.org/cpython/rev/c0a9fb3e19b9

New changeset fcb19fb42058 by Serhiy Storchaka in branch '3.6':
Issue #26729: Fixed __text_signature__ for sorted().
https://hg.python.org/cpython/rev/fcb19fb42058

New changeset 4ad195d9e184 by Serhiy Storchaka in branch 'default':
Issue #26729: Fixed __text_signature__ for sorted().
https://hg.python.org/cpython/rev/4ad195d9e184

--
nosy: +python-dev

___
Python tracker 

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



[issue26729] Incorrect __text_signature__ for sorted

2017-01-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: commit 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



[issue29350] Add support of multiple signatures

2017-01-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Some functions can be described by the single signature. See examples in 
msg285647. Selected examples:

  dict.pop(key)
  dict.pop(key, default)

  type(obj)
  type(name, bases, mapping)

  range(stop)
  range(start, stop, step=1)

  min(iterable, *, key=identity)
  min(iterable, *, default, key=identity)
  min(*args, key=identity)

I think the only way to resolve this problem is to add the support of multiple 
signatures in inspect, pydoc, Argument Clinic, etc.

--
components: Library (Lib)
messages: 286068
nosy: larry, rhettinger, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Add support of multiple signatures
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-01-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We can't just add API functions in maintained releases, because it will break 
the stable ABI. We can use them only when explicitly define the version of API.

Proposed patch for 3.6 and 3.7 adds public API functions PySlice_Unpack() and 
PySlice_AdjustIndices() and makes PySlice_GetIndicesEx() a macro if set 
Py_LIMITED_API to the version that supports new API. Otherwise 
PySlice_GetIndicesEx() becomes deprecated.

This doesn't break extensions compiled with older Python versions. Extensions 
compiled with new Python versions without limited API or with high API version 
are not compatible with older Python versions as expected, but have fixed the 
original issue. Compiling extensions with new Python versions with set low 
Py_LIMITED_API value will produce a deprecation warning.

Pay attention to names and signatures of new API. It would be hard to change it 
when it added.

I think this is the safest way. In 2.7 we should replace PySlice_GetIndicesEx() 
with a macro for internal use only if we want to fix an issue for builtins and 
preserve a binary compatibility.

--
priority: normal -> high
Added file: http://bugs.python.org/file46388/slice_get_indices_3.patch

___
Python tracker 

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



[issue29339] Interactive: Move to same indentation level as previous line

2017-01-23 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

I'm not exactly sure what you mean but, since this isn't a bug per se and is 
more of a subjective opinion on how the REPL should handle the indentation 
level, you should probably ask *first* on python-ideas to get input from other 
members. (See https://docs.python.org/devguide/faq.html#suggesting-changes)

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue29349] Update old Python 2 code in Docs/tools/extensions/patchlevel.py

2017-01-23 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

There's a hidden Python 2 print call in the script that only gets reached after 
you move the Doc/ folder outside the main CPython directory and run `make 
html`. 

Additionally, an obsolete way of assuring a file gets closed is used (changed 
to use `with` statement).

P.S: Tagged this with the Documentation component, maybe build is more 
applicable but I wasn't sure.

--
assignee: docs@python
components: Documentation
files: patchlevel.patch
keywords: patch
messages: 286065
nosy: Jim Fasarakis-Hilliard, docs@python
priority: normal
severity: normal
status: open
title: Update old Python 2 code in Docs/tools/extensions/patchlevel.py
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46387/patchlevel.patch

___
Python tracker 

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



[issue28749] Fixed the documentation of the mapping codec APIs

2017-01-23 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

>> The only part that is not correct is "single string characters".
>> This should read "single bytes" or "bytes strings of length 1".
>
> This is not correct. Decoding mappings map not bytes strings, but
integers.

Looking at the implementation, you're right. AFAIR, the first
incarnation of the charmap codec used single chars in Python 2.
I guess the documentation was never updated when the change was
made to use integers instead.

> And this is not the only incorrect part. Decoding mappings can map to
> multicharacter Unicode strings, not to single Unicode  characters. Not
just
> None, but the integer 0xfffe and Unicode string '\ufffe' mean "undefined
> mapping".

Yes, this was added later on as well. Apparently the docs
were never updated.

> There are similar incorrectnesses about encoding mappings.

Ok, fair enough, let's remove the two paragraphs.

>> I also don't see where you copied the description. Without some
>> description of what "mappings" are in the context of the charmap
>> codec, it's not easy to understand what the purpose of these
>> APIs is. Please just fix the bytes wording instead of removing the
>> whole intro.
>
> Decoding mappings were desribed in the introduction and in the
description of
> PyUnicode_DecodeCharmap() (both are outdated and incomplete). I merged
and
> corrected descriptions and left it only in one place, since
> PyUnicode_DecodeCharmap() is the only function that needs this. Same for
> encoding mappings. Both decoding and encoding mappings do not have a
relation
> to PyUnicode_Translate(). The paragraph about a LookupError in the
> introduction was totally wrong. I left in the introduction only common
part.
> Other details are too different in decoding, encoding and translation
mappings.
>
>> >> Also, this wording needs to be corrected: "bytes (integers in the
range
>> >> from 0 to 255)". Bytes are not integers. I'd suggest to use the more
>> >> correct wording "bytes strings of length 1".>
>> > The word "bytes" means here not Python bytes object, but is used in
more
>> > common meaning: an integer in the range from 0 to 255.
>> That's confusing, since we use the term "bytes" as referring
>> to the bytes object in Python. Please use "integers in the range
>> 0-255".
>
> Okay, I'll remove the word "bytes" here. But how would you formulate the
> following sentence: "Unmapped bytes (ones which cause a
:exc:`LookupError`) as
> well as mapped to ``None``, ``0xFFFE`` or ``'\ufffe'`` are treated as
"undefined
> mapping" and cause an error."?

Better:

"""
If *mapping* is *NULL*, Latin-1 decoding will be applied.  Else
*mapping* must map bytes ordinals (integers in the range from 0 to 255)
to Unicode strings, integers (which are then interpreted as Unicode
ordinals) or ``None``. Unmapped data bytes - ones which cause a
:exc:`LookupError`, as well as ones which get mapped to ``None``,
``0xFFFE`` or ``'\ufffe'``, are treated as undefined mappings and cause
an error.
"""

>> Aside: The deprecation of PyUnicode_EncodeCharmap() also seems misplaced
>> in this context, since only the Py_UNICODE version of the API is
>> deprecated. The functionality still exists and is useful. An API
>> similar to the _PyUnicode_EncodeCharmap() API should be made publicly
>> available to accommodate for the deprecation, since the mentioned
>> PyUnicode_AsCharmapString() and PyUnicode_AsEncodedString()
>> APIs are not suitable as replacement. PyUnicode_AsCharmapString()
>> doesn't support error handling (strange, BTW) and
>> PyUnicode_AsEncodedString() has a completely unrelated meaning (no
>> idea why it's mentioned here at all).
>
> Only PyUnicode_EncodeCharmap() is deprecated,
PyUnicode_AsCharmapString() is
> not deprecated. I placed the deprecated function just after its
non-deprecated
> counerpart following the pattern for other deprecated functions. If
you prefer
> I'll move both deprecated functions (PyUnicode_EncodeCharmap and
> PyUnicode_TranslateCharmap) together at the end of this section.

No, I'd prefer this deprecation to be undone as long as we
don't have a proper alternative for the API.

Looking at the various deprecations for the Py_UNICODE APIs,
I find that the Unicode API symmetry was severely broken.
In the Python 2 API, we always have an PyUnicode_Encode...() and
corresponding PyUnicode_Decode...() API for every codec.

In Python 3, the encode APIs were apparently all deprecated
due to their use of Py_UNICODE and only the the much less useful
PyUnicode_As...String() APIs were left, which intentionally do not
have an error argument, because they were intended as quick
replacement for PyString_AsString() uses in Python 2.

> I don't know why PyUnicode_AsCharmapString() don't support the errors
> argument. I added PyUnicode_AsEncodedString() as a replacement
(issue19569)
> because this is the only public non-deprecated way to do a charmap
encoding
> with errors handling. There is no exact equivalent, but
> PyUnicode_AsCharmapString() and 

[issue26729] Incorrect __text_signature__ for sorted

2017-01-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Serhiy, do you want to apply this?

--

___
Python tracker 

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



[issue26729] Incorrect __text_signature__ for sorted

2017-01-23 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: rhettinger -> serhiy.storchaka

___
Python tracker 

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



[issue29347] Python 2.7.8 is crashing while creating weakref for a given object.

2017-01-23 Thread Christian Heimes

Christian Heimes added the comment:

Can you reproduce the issue with a more recent version of Python 2.7? 2.7.8 is 
pretty old.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue29338] Output the text signature in the help of a class

2017-01-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The patch looks fine and meets a real need.  I say go ahead and apply it if no 
other objections arise.

--

___
Python tracker 

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



  1   2   >