[issue35928] socket makefile read-write discards received data

2019-02-10 Thread Ammar Askar


Ammar Askar  added the comment:

Recreatable on master as well, also Martin your suspicion seems correct, 
reverting 
https://github.com/python/cpython/commit/23db935bcf258657682e66464bf8512def8af830
 fixes it.

--
nosy: +ammar2, serhiy.storchaka
stage:  -> needs patch
versions: +Python 3.8

___
Python tracker 

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



[issue35928] socket makefile read-write discards received data

2019-02-10 Thread Palle Ravn


Palle Ravn  added the comment:

>>> f = TextIOWrapper(BufferedRWPair(BytesIO(b"Hello\nYou\n"), BytesIO()))
>>> f.readline()
'Hello\n'
>>> f.write(_)
6
>>> f.readline()  # Returns empty string
''

--

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-10 Thread Davin Potts


Davin Potts  added the comment:

@giampaolo.rodola: Your patch from 3 days ago in issue35917 included additional 
tests around the SharedMemoryManager which are now causing test failures in my 
new PR.  This is my fault because I altered SharedMemoryManager to no longer 
support functionality from SyncManager that I thought could be confusing to 
include.  I am just now discovering this and am not immediately sure if simply 
removing the SharedMemoryManager-relevant lines from your patch is the right 
solution but I wanted to mention this thought right away.

Thank you for discovering that SyncManager was being overlooked in the tests 
and the nice patch in issue35917.

--

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-10 Thread Davin Potts


Davin Potts  added the comment:

Docs and tests are now available in a new PR.  I have stayed focused on getting 
these docs and tests to everyone without delay but that means I have not yet 
had an opportunity to respond to the helpful comments, thoughtful questions, 
and threads that have popped up in the last few days.  I will follow up with 
all comments as quickly as possible starting in the morning.

There are two topics in particular that I hope will trigger a wider discussion: 
 the api around the SharedMemory class and the inclusion-worthiness of the 
shareable_wrap function.

Regarding the api of SharedMemory, the docs explain that not all of the current 
input parameters are supportable/enforceable across platforms.  I believe we 
want an api that is relevant across all platforms but at the same time we do 
not want to unnecessarily suppress/hide functionality that would be useful on 
some platforms -- there needs to be a balance between these motivations but 
where do we strike that balance?

Regarding the inclusion-worthiness of the shareable_wrap function, I 
deliberately did not include it in the docs but its docstring in the code 
explains its purpose.  If included, it would drastically simplify working with 
NumPy arrays; please see the code example in the docs demonstrating the use of 
NumPy arrays without the aid of the shareable_wrap function.  I have received 
feedback from others using this function also worth discussing.


Thank you to everyone who has already looked at the code and shared helpful 
thoughts -- please have a look at the tests and docs.

--

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-10 Thread Davin Potts


Change by Davin Potts :


--
pull_requests: +11834

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-10 Thread Davin Potts


Change by Davin Potts :


--
pull_requests: +11834, 11835, 11836

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-10 Thread Davin Potts


Change by Davin Potts :


--
pull_requests: +11834, 11835

___
Python tracker 

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



[issue35951] os.renames() creates directories if original name doesn't exist

2019-02-10 Thread Ammar Askar


Ammar Askar  added the comment:

Aah, I interpreted the combination of the warning and the fact that it says 
"attempted first" to mean that any failures in the actual renaming will leave 
the new directory in place. That is, no cleanup is ever performed.

A quick glance at the code seems to suggest that as well.

--

___
Python tracker 

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



[issue35951] os.renames() creates directories if original name doesn't exist

2019-02-10 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Lacking permissions seems very different to me from the source directory or 
file not existing. For example, in the example I provided, I did have the 
needed permissions.

Incidentally (and this is a separate documentation issue), the note seems 
unclear as to whether "the leaf directory or file" the user lacks permissions 
to remove is in reference to the "rightmost path segments of the old name" 
being pruned away, or the new directory structure to be removed on failure.

--

___
Python tracker 

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



[issue35960] dataclasses.field does not preserve empty metadata object

2019-02-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eric.smith

___
Python tracker 

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



[issue35961] gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small

2019-02-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I too saw this a week back but couldn't reproduce it. There is one another test 
that fails like this and passes on verbose mode issue35809 . Travis doesn't 
report tests that fail in the complete run and pass during verbose run like 
buildbots do.

--
nosy: +xtreak

___
Python tracker 

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



[issue35460] Add PyDict_GetItemStringWithError

2019-02-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-1 for expanding this API.  As Serhiy pointed-out, PyDict_GetItemString() is an 
old API kept just for backward compatibility.  For your use case, it is easy to 
call PyUnicode_FromString(key) and then follow-up with 
PyDict_GetItemWithError().  The latter way is more flexible in that it allows 
you to cache the unicode object for future use (something you're going to want 
to do if you care about performance).  The latter way also lets you intern the 
string as well.

FWIW, if it is only your own code, it is trivially easy to write your own 
helper function if that is what you needed for a single porting project.  IMO, 
unnecessarily adding to many variants of the same function just makes the API 
harder to learn (see all the ObjectCall variants for example) and makes the 
code harder for us to maintain.  ISTM most of the concrete APIs are 
deliberately sparse, so adding this variant would be a change in the philosophy 
of the C-API.  Also, we mostly want people to use the abstract API unless they 
know for sure that a target dictionary is an exact dict (this has been an 
outstanding problem for OrderedDicts for example).

--
nosy: +rhettinger

___
Python tracker 

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



[issue35889] sqlite3.Row doesn't have useful repr

2019-02-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 from me.  We're already made regular expression match objects less opaque 
and that has been useful.  There's no need for a python-ideas discussion for 
this.

If a repr doesn't round-trip, we generally put it angle brackets (see PEP 8):

>>> re.search(r'([a-z]+)(\d*)', 'alpha7')


The Row object access style uses square brackets and has a keys() method.  That 
suggests a dict-like representation would be intuitive and match how Row 
objects are used:  ro['salary'] and ro.keys().

Putting those two ideas together we get:



Note the OP's suggestion for keyword argument style doesn't make sense for two 
reasons: 1) Row objects don't allow attribute access (i.e. ro.name is invalid) 
and 2) the field names are not required to be valid Python identifiers (i.e. 
ro['class'] is possible but ro.class is syntactically invalid because "class" 
is a keyword).

--
nosy: +rhettinger

___
Python tracker 

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



[issue35796] time.localtime returns error for negative values

2019-02-10 Thread Ammar Askar


Ammar Askar  added the comment:

Victor is correct, this is a limitation in Windows. As the documentation for 
time notes:

>Although this module is always available, not all functions are available on 
>all platforms. Most of the functions defined in this module call platform C 
>library functions with the same name. It may sometimes be helpful to consult 
>the platform documentation, because the semantics of these functions varies 
>among platforms.

https://docs.python.org/3/library/time.html#module-time

And as the Windows documentation notes: 

>less than 0 or greater than _MAX__TIME64_T: EINVAL

https://msdn.microsoft.com/en-us/library/a442x3ye.aspx?f=255=-2147217396

--
nosy: +ammar2
resolution:  -> not a bug
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



[issue35960] dataclasses.field does not preserve empty metadata object

2019-02-10 Thread Christopher Hunt


Change by Christopher Hunt :


--
keywords: +patch, patch, patch
pull_requests: +11831, 11832, 11833
stage:  -> patch review

___
Python tracker 

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



[issue35960] dataclasses.field does not preserve empty metadata object

2019-02-10 Thread Christopher Hunt


Change by Christopher Hunt :


--
keywords: +patch, patch
pull_requests: +11831, 11832
stage:  -> patch review

___
Python tracker 

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



[issue35960] dataclasses.field does not preserve empty metadata object

2019-02-10 Thread Christopher Hunt


Change by Christopher Hunt :


--
keywords: +patch
pull_requests: +11831
stage:  -> patch review

___
Python tracker 

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



[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2019-02-10 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> never enable lchmod on Linux

___
Python tracker 

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



[issue28627] [alpine] shutil.copytree fail to copy a direcotry with broken symlinks

2019-02-10 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> duplicate
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



[issue35956] Sort documentation could be improved for complex sorting

2019-02-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It seems to me that the sorting howto covers this topic.

If I'm reading the OP's task correctly, it isn't complex at all:

   points.sort(key=attrgetter('x', 'y'))  # x is primary key; y is secondary

--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue35951] os.renames() creates directories if original name doesn't exist

2019-02-10 Thread Ammar Askar


Ammar Askar  added the comment:

It seems this behavior is somewhat documented: 
https://docs.python.org/3/library/os.html#os.renames

>Works like rename(), except creation of any intermediate directories needed to 
>make the new pathname good is attempted first.
>This function can fail with the new directory structure made if you lack 
>permissions needed to remove the leaf directory or file.


The source directory not existing isn't the same as not having permissions to 
remove it but close enough.

--
nosy: +ammar2

___
Python tracker 

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



[issue35961] gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small

2019-02-10 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

I am seeing some failures in travis and some buildbots:

0:02:24 load avg: 3.30 [147/420/1] test_slice crashed (Exit code -6) -- 
running: test_multiprocessing_spawn (32 sec 523 ms), test_asyncio (45 sec 433 
ms), test_multiprocessing_forkserver (47 sec 869 ms)
Modules/gcmodule.c:110: gc_decref: Assertion "gc_get_refs(g) > 0" failed: 
refcount is too small
Enable tracemalloc to get the memory block allocation traceback
object  : .BadCmp object at 
0x2ab2051faef0>
type: BadCmp
refcount: 1
address : 0x2ab2051faef0
Fatal Python error: _PyObject_AssertFailed
Current thread 0x2ab1fe0519c0 (most recent call first):
  File "/home/travis/build/python/cpython/Lib/test/test_slice.py", line 107 in 

  File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 197 in 
handle
  File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 782 in 
assertRaises
  File "/home/travis/build/python/cpython/Lib/test/test_slice.py", line 107 in 
test_cmp
  File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 642 in run
  File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 702 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in 
run
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in 
run
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in 
run
  File "/home/travis/build/python/cpython/Lib/unittest/runner.py", line 176 in 
run
  File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 
1935 in _run_suite
  File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 
2031 in run_unittest
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", 
line 178 in test_runner
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", 
line 182 in runtest_inner
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", 
line 127 in runtest
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest_mp.py", 
line 68 in run_tests_worker
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 
600 in _main
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 
586 in main
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 
640 in main
  File "/home/travis/build/python/cpython/Lib/test/regrtest.py", line 46 in 
_main
  File "/home/travis/build/python/cpython/Lib/test/regrtest.py", line 50 in 

  File "/home/travis/build/python/cpython/Lib/runpy.py", line 85 in _run_code

Usually, this happens with test_slice but when the test runner runs test_slice 
in isolation, it succeeds.

I am afraid that this will be a weird combination of tests.

--
components: Tests
messages: 335185
nosy: pablogsal
priority: normal
severity: normal
status: open
title: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small
versions: Python 3.8

___
Python tracker 

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



[issue35960] dataclasses.field does not preserve empty metadata object

2019-02-10 Thread Christopher Hunt

New submission from Christopher Hunt :

The metadata argument to dataclasses.field is not preserved in the resulting 
Field.metadata attribute if the argument is a mapping with length 0.

The docs for dataclasses.field state:

> metadata: This can be a mapping or None. None is treated as an empty dict. 
> This value is wrapped in MappingProxyType() to make it read-only, and exposed 
> on the Field object.

The docs for MappingProxyType() state:

> Read-only proxy of a mapping. It provides a dynamic view on the mapping’s 
> entries, which means that when the mapping changes, the view reflects these 
> changes.

I assumed that the mapping provided could be updated after class initialization 
and the changes would reflect in the field's metadata attribute. Indeed this is 
the case when the mapping is non-empty, but not when the mapping is initially 
empty.

For example:

$ python
Python 3.8.0a1+ (heads/master:9db56fb8fa, Feb 10 2019, 19:54:10)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from dataclasses import field
>>> d = {}
>>> v = field(metadata=d)
>>> d['i'] = 1
>>> v.metadata
mappingproxy({})
>>> v = field(metadata=d)
>>> v.metadata
mappingproxy({'i': 1})
>>> d['j'] = 2
>>> v.metadata
mappingproxy({'i': 1, 'j': 2})

In my case I have a LazyDict into which I was trying to save partial(callback, 
field). I could not have the field before it was initialized so I tried:

d = {}
member: T = field(metadata=d)
d['key'] = partial(callback, field)

and it failed same as above.

As a workaround, one can set a dummy value in the mapping prior to calling 
dataclasses.field and then remove/overwrite it afterwards.

--
components: Library (Lib)
messages: 335184
nosy: chrahunt
priority: normal
severity: normal
status: open
title: dataclasses.field does not preserve empty metadata object
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue35808] Let's retire pgen

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests:  -11829, 11830

___
Python tracker 

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



[issue35808] Let's retire pgen

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests:  -11830

___
Python tracker 

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



[issue35808] Let's retire pgen

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch, patch
pull_requests: +11828, 11829, 11830
stage: needs patch -> patch review

___
Python tracker 

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



[issue35808] Let's retire pgen

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch
pull_requests: +11828, 11829
stage: needs patch -> patch review

___
Python tracker 

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



[issue35808] Let's retire pgen

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +11828
stage: needs patch -> patch review

___
Python tracker 

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



[issue23460] Decimals do not obey ':g' exponential notation formatting rules

2019-02-10 Thread Brennan D Baraban


Brennan D Baraban <3...@holbertonschool.com> added the comment:

What is the status of this issue? I can submit a PR based on Tuomas Suutari's 
patch.

--
nosy: +bdbaraban

___
Python tracker 

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Thanks Raymond for the interesting use-case.

The original design of mode() was support only the basic form taught in 
secondary schools, namely a single unique mode for categorical data or 
discrete numerical data.

I think it is time to consider a richer interface to support more uses, 
such as estimating the mode of continuous numerical data, and the 
multi-mode case you bring up.

One reason I've been hesitant is that deciding what is the right 
behaviour is quite hard (or at least it has been for me). I think there 
are a few cases to consider:

- the existing behaviour (which may not be very useful?) which is to
  raise an exception unless the mode is unique; 

- would it be more useful to return an out-of-band value like a NAN 
  or None?

- the multi-mode case where you want some arbitrary(?) mode, possibly
  the left-most (smallest) for numeric data;

- the multi-mode case where you want all the modes.

I like Francis' suggestion to use an enum to select the behavioural, er, 
mode (pun intended). What do you think?

--

___
Python tracker 

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



[issue35904] Add statistics.fmean(seq)

2019-02-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> Would you like me to submit a PR with docs and tests?

Yes please! I'm happy with the name fmean.

--

___
Python tracker 

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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-02-10 Thread Brennan D Baraban


Brennan D Baraban <3...@holbertonschool.com> added the comment:

Got it, makes sense. Thank you. New contributor here :)

--

___
Python tracker 

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



[issue12317] inspect.getabsfile() is not documented

2019-02-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Given the absence of agreement among core-devs, a PR is a bit premature.  

Looking again at the existing docstring, I think it must be revised before 
copying and *not* copied as is.

0. The existing first sentence mislead me.  The 'source or compiled file' must 
be a Python source or compiled Python (.pyc) file.  An object in a compiled C 
file gives a TypeError.  Change 'an object' to 'a Python-coded object'.

1. The 'object' argument cannot be just any Python-coded object (class object 
instance).  Based on the exception message, add this second sentence: "The 
object must be a module, class, method, function, traceback, frame, or code 
object."  Otherwise, TypeError.

2. The second paragraph is garbled.  All objects in a module have a common 
origin, not a unique origin.  I think the idea is that the name for the origin 
should be a standardized full path.  I think that this paragraph adds so little 
that it should be deleted rather than revised.

What paused this issue was Brett's opinion that getabsfile is untrustworthy 
and, with __file__ absolute, 'pointless', to a degree that it should not be 
documented. (If that were true, it should be deprecated.)

I read the 3.7.2 source for getabsfile, getsourcefile, and getfile. The 
returned name is based on either module.__file__ or code.co_filename. I think 
the function should be kept and documented.

1. Assuming that both __file__ and co_filename are now normcased and normalized 
absolute paths, (and identical for functions,) then 
"os.path.normcase(os.path.abspath(_filename))" is a no-op returning _filename 
as is, and should be dropped.  There is no longer a "guess at what the cwd was 
when a module was imported" in getabsfile itself.

2. getfile and getsourcefile do non-trivial switching and name processing that 
users would not get right if getabsfile were not present.

--

___
Python tracker 

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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-02-10 Thread Ethan Furman


Ethan Furman  added the comment:

Let's give Maxwell until the 14th (so a week from when I asked him to turn his 
code into a patch) and if nothing from him by then you are welcome to take it 
over.

--

___
Python tracker 

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



[issue34652] never enable lchmod on Linux

2019-02-10 Thread Anthony Sottile


Anthony Sottile  added the comment:

I believe this also closes https://bugs.python.org/issue31940 and 
https://bugs.python.org/issue28627

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue35899] '_is_sunder' function in 'enum' module fails on empty string

2019-02-10 Thread Brennan


Brennan <3...@holbertonschool.com> added the comment:

I'm not sure if Maxwell is still working on this issue, but may I pick it up? I 
can submit a PR within the day.

--
nosy: +bdbaraban

___
Python tracker 

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



[issue35940] multiprocessing manager tests fail in the Refleaks buildbots

2019-02-10 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

Pablo thanks a lot for taking care of this.

--

___
Python tracker 

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



[issue35278] [security] directory traversal in tempfile prefix

2019-02-10 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Adding Łukasz to the nosy list as release manager.

--
nosy: +cheryl.sabella, lukasz.langa

___
Python tracker 

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



[issue9584] fnmatch, glob: Allow curly brace expansion

2019-02-10 Thread Matúš Valo

Matúš Valo  added the comment:

Hi All,

this is a humble ping.

--

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +11825, 11826, 11827

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +11825

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +11825, 11826

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue35940] multiprocessing manager tests fail in the Refleaks buildbots

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

PR11808 fixes the error and add some basic test. Please review the PR instead :)

--

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch, patch
pull_requests: +11822, 11823, 11824
stage:  -> patch review

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch
pull_requests: +11822, 11823
stage:  -> patch review

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +11822
stage:  -> patch review

___
Python tracker 

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



[issue35936] Give modulefinder some much-needed updates.

2019-02-10 Thread Brandt Bucher


Brandt Bucher  added the comment:

Alright, I've gotten all of the tests passing for the new importlib-only 
implementation. I broke these modifications out into a new private function, 
_find_module, to make it clear that this fix is a simple drop-in replacement 
for imp.find_module.

Let me know if there's anything I've missed or could improve. Otherwise, I feel 
my work here is done!

--

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Could it be 
https://github.com/python/cpython/blob/master/Modules/mathmodule.c#L2565

When 0 is in the iterator, i_result get sets to 0 and then on the next 
iteration x/i_result is 0/0 which is undefined behavior?

C99 6.5.5p5 - The result of the / operator is the quotient from the division of 
the first operand by the second; the result of the % operator is the remainder. 
In both operations, if the value of the second operand is zero, the behavior is 
undefined.

I will do some tests, if it's that I will post a patch.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The problem is that the intermediate result (i_result) can be 0 when doing the 
overflow check:

x / i_result != b

i am working on a fix.

--

___
Python tracker 

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



[issue35959] math.prod(range(10)) caues segfault

2019-02-10 Thread Karthikeyan Singaravelan

New submission from Karthikeyan Singaravelan :

math.prod introduced with issue35606 seems to segfault when zero is present on 
some cases like start or middle of the iterable. I couldn't find the exact 
cause of this. This also occurs in optimized builds.

# Python information built with ./configure && make

➜  cpython git:(master) ./python.exe
Python 3.8.0a1+ (heads/master:8a03ff2ff4, Feb 11 2019, 00:13:49)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

# Segfaults with range(10), [0, 1, 2, 3] and [1, 0, 2, 3]

➜  cpython git:(master) ./python.exe -X faulthandler -c 'import math; 
print(math.prod(range(10)))'
Fatal Python error: Floating point exception

Current thread 0x7fff7939f300 (most recent call first):
  File "", line 1 in 
[1]40465 floating point exception  ./python.exe -X faulthandler -c 'import 
math; print(math.prod(range(10)))'

➜  cpython git:(master) ./python.exe -X faulthandler -c 'import math; 
print(math.prod([0, 1, 2, 3]))'
Fatal Python error: Floating point exception

Current thread 0x7fff7939f300 (most recent call first):
  File "", line 1 in 
[1]40414 floating point exception  ./python.exe -X faulthandler -c 'import 
math; print(math.prod([0, 1, 2, 3]))'
➜  cpython git:(master) ./python.exe -X faulthandler -c 'import math; 
print(math.prod([1, 0, 2, 3]))'
Fatal Python error: Floating point exception

Current thread 0x7fff7939f300 (most recent call first):
  File "", line 1 in 
[1]40425 floating point exception  ./python.exe -X faulthandler -c 'import 
math; print(math.prod([1, 0, 2, 3]))'


# No segfault when zero is at the end and floats seem to work fine.

➜  cpython git:(master) ./python.exe -X faulthandler -c 'import math; 
print(math.prod([1, 2, 3, 0]))'
0
➜  cpython git:(master) ./python.exe -c 'import math; 
print(math.prod(map(float, range(10'
0.0

--
components: Library (Lib)
messages: 335168
nosy: pablogsal, rhettinger, xtreak
priority: normal
severity: normal
status: open
title: math.prod(range(10)) caues segfault
type: crash
versions: Python 3.8

___
Python tracker 

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



[issue35956] Sort documentation could be improved for complex sorting

2019-02-10 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Take a look at issue 35020 which discusses multisort.

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue35958] io.IOBase subclasses don't play nice with abc.abstractmethod

2019-02-10 Thread Jon McMahon


New submission from Jon McMahon :

Subclasses of io.IOBase can be instantiated with abstractmethod()s, even though 
ABCs are supposed to prevent this from happening. I'm guessing this has to do 
with io using the _io C module because the alternative pure-python 
implementation _pyio doesn't seem to have this issue. I'm using Python 3.6.7

>>> import _pyio
>>> import io
>>> import abc
>>> class TestPurePython(_pyio.IOBase):
... @abc.abstractmethod
... def foo(self):
... print('Pure python implementation')
... 
>>> class TestCExtension(io.IOBase):
... @abc.abstractmethod
... def bar(self):
... print('C extension implementation')
... 
>>> x=TestPurePython()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Can't instantiate abstract class TestPurePython with abstract 
methods foo
>>> y=TestCExtension()
>>> y.bar()
C extension implementation
>>>

--
components: IO
messages: 335166
nosy: Jon McMahon
priority: normal
severity: normal
status: open
title: io.IOBase subclasses don't play nice with abc.abstractmethod
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



[issue35957] Indentation explanation is unclear

2019-02-10 Thread Jérôme LAURENS

New submission from Jérôme LAURENS :

https://docs.python.org/3/reference/lexical_analysis.html#indentation reads

Point 1:
"Tabs are replaced (from left to right) by one to eight spaces such that the 
total number of characters up to and including the replacement is a multiple of 
eight"

and in the next paragraph

Point 2:
"Indentation is rejected as inconsistent if a source file mixes tabs and spaces 
in a way that makes the meaning dependent on the worth of a tab in spaces"

In point 1, each tab has definitely a unique space counterpart, in point 2, 
tabs may have different space counterpart, which one is reliable ?

The documentation should state that Point 1 concerns cPython, or at least 
indicate that the 8 may depend on the implementation, which then gives sense to 
point 2.

--
assignee: docs@python
components: Documentation
messages: 335165
nosy: Jérôme LAURENS, docs@python
priority: normal
severity: normal
status: open
title: Indentation explanation is unclear
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



[issue35956] Sort documentation could be improved for complex sorting

2019-02-10 Thread SilentGhost


SilentGhost  added the comment:

Is this not equivalent to the following?

  sorted(points, key=lambda p: (p.y, p.x))

--
nosy: +SilentGhost

___
Python tracker 

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



[issue35956] Sort documentation could be improved for complex sorting

2019-02-10 Thread fabrice salvaire


New submission from fabrice salvaire :

I just implemented Graham Scan algorithm in Python 3 and have to read carefully 
the sort documentation.  Notice this is a good algorithm for a large audience 
language like Python.

Since Python 3, the old order function cmp is depicted as an old way to proceed.

But some sorting procedure require complex order like this

def sort_by_y(p0, p1):
return p0.x - p1.x if (p0.y == p1.y) else p0.y - p1.y
sorted(points, key=cmp_to_key(sort_by_y))

which is less natural to implement than

def sort_by_y(p0, p1):
return p0.x < p1.x if (p0.y == p1.y) else p0.y < p1.y
sorted(points, cmp=sort_by_y)

Since Python 3 we should do this

points.sort(key=attrgetter('x'))
points.sort(key=attrgetter('y'))

But we must take care to the chaining order !!! Here we must sort first on x 
then on y.

I think the documentation could explain much better how to perform complex sort 
and the performance of the Python sort algorithm.  Is the old way faster than 
the new one ???  What about short and large array ???  What happen when we sort 
a zillion of short array ???

--
assignee: docs@python
components: Documentation
messages: 335163
nosy: FabriceSalvaire, docs@python
priority: normal
severity: normal
status: open
title: Sort documentation could be improved for complex sorting
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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This feels safer to me with respect to backwards compatibility and also that it 
might be easier to backport this to mock on GitHub which works with Python 2.7. 
I have less knowledge on difference between tuple and namedtuple internals so I 
might be wrong here.

--

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

@xtreak, couldn't we have made `_Call` inherit from namedtuple to achieve a 
similar result (albeit the handling of name would be weird)?

--

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I like this patch, working with calls often feels weird and this change 
simplify attribute access.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35460] Add PyDict_GetItemStringWithError

2019-02-10 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

There are more reasons to implement in C than just speed ;-). In my code I have 
two usecases for using PyDict_GetItemString, both not in performance critical 
code

1) Look up a hardcoded name in a dictionary. These could be switched to the Id 
API if that were public (and I might implement something like the Id API 
myself). 

2) Look up a name that is passed in as a "char*" from C code that's outside of 
my control.  This is a real use case for a PyDict_GetItemString API and not 
easilty converted to another API.

In PyObjC the majority of calls to PyDict_GetItemString are in the first 
category, while most of the latter would probably be better of using a 
PyDict_GetItemBytes API.  Although I definitely to not propose to add such an 
API to CPython.

--

___
Python tracker 

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



[issue35878] ast.c: end_col_offset may be used uninitialized in this function

2019-02-10 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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



[issue35955] unittest assertEqual reports incorrect location of mismatch

2019-02-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Sorry to comment on a closed issue. I see the following behavior with 
difflib.ndiff which is used under the hood by unittest. The strings that differ 
by '-' and 'w' generate different output compared to 'a' and 'w'. I find the 
output for diff using '-' and 'w' little confusing and is this caused due to 
'-' which is also used as a marker in difflib?

$ ./python.exe
Python 3.8.0a1+ (heads/master:8a03ff2ff4, Feb  9 2019, 10:42:29)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import difflib
>>> print(''.join(difflib.ndiff(["drwxrwxr-x 2 2000  2000\n"], ["drwxr-xr-x 2 
>>> 2000  2000\n"])))
- drwxrwxr-x 2 2000  2000
?  ---
+ drwxr-xr-x 2 2000  2000
?+++

>>> print(''.join(difflib.ndiff(["drwxrwxr-x 2 2000  2000\n"], ["drwxraxr-x 2 
>>> 2000  2000\n"])))
- drwxrwxr-x 2 2000  2000
?  ^
+ drwxraxr-x 2 2000  2000
?  ^

--
nosy: +xtreak

___
Python tracker 

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



[issue35460] Add PyDict_GetItemStringWithError

2019-02-10 Thread Stefan Behnel


Stefan Behnel  added the comment:

The overhead of calling PyErr_Occurred() is definitely negligible in something 
as involved as PyDict_GetItemStringWithError(), where a mere key lookup first 
has to fire up the string decoder on a C character buffer to create a new 
string object and then calculate its hash value, just to throw away all that 
right after the tiny time interval that it takes to look up the key in the 
dict. It is not something I would encourage anyone to do in code that has only 
the slightest excuse for being implemented in C. :)

Rather, I would propose to open up the ID-String API that CPython uses 
internally, so that user code can benefit from fast lookups of interned strings 
with pre-initialised hash values, without having to care about creating and 
cleaning up string constants themselves all the time.

(FWIW, Cython also generates interned string constants automatically, but does 
not currently use the ID-API, also because it does it for *all* its strings, 
not just those that resemble identifiers etc.)

--
nosy: +scoder

___
Python tracker 

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



[issue35955] unittest assertEqual reports incorrect location of mismatch

2019-02-10 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I was able to replicate the issue using pytest and not unittest, so I've 
[reported the issue with that 
project](https://github.com/pytest-dev/pytest/issues/4765).

--

___
Python tracker 

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



[issue35955] unittest assertEqual reports incorrect location of mismatch

2019-02-10 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
resolution:  -> third party
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



[issue35955] unittest assertEqual reports incorrect location of mismatch

2019-02-10 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I should acknowledge that I'm using pytest here also... and pytest may be the 
engine that's performing the reporting of the failed assertion.

In fact, switching to simple assertions, I see the same behavior, so I now 
suspect the issue may lie with pytest and not unittest.

--

___
Python tracker 

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



[issue35955] unittest assertEqual reports incorrect location of mismatch

2019-02-10 Thread Jason R. Coombs


New submission from Jason R. Coombs :

In [this job](https://travis-ci.org/jaraco/cmdix/jobs/491246158), a project is 
using assertEqual to compare two directory listings that don't match in the 
group. But the hint markers pointing to the mismatch are pointing at positions 
that match:

E   AssertionError: '--w-[50 chars]drwxrwxr-x 2 2000  20004096 
2019-02-10 14:[58 chars]oo\n' != '--w-[50 chars]drwxr-xr-x 2 2000  20004096 
2019-02-10 14:[58 chars]oo\n'
E --w-r---wx 1 2000  2000  99 2019-02-10 14:02 bar
E   - drwxrwxr-x 2 2000  20004096 2019-02-10 14:02 biz
E   ?  ---
E   + drwxr-xr-x 2 2000  20004096 2019-02-10 14:02 biz
E   ?+++
E   - -rw-rw-r-- 1 2000  2000 100 2019-02-10 14:02 foo
E   ? ---
E   + -rw-r--r-- 1 2000  2000 100 2019-02-10 14:02 foo
E   ?+++

As you can see, it's the 'group' section of the flags that differ between the 
left and right comparison, but the hints point at the 'user' section for the 
left side and the 'world' section for the right side, even though they match.

I observed this on Python 3.7.1. I haven't delved deeper to see if the issue 
exists on 3.7.2 or 3.8.

--
components: Library (Lib)
messages: 335154
nosy: jaraco
priority: normal
severity: normal
status: open
title: unittest assertEqual reports incorrect location of mismatch

___
Python tracker 

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



[issue35953] crosscompilation fails with clang on android

2019-02-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xdegaye

___
Python tracker 

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



[issue35460] Add PyDict_GetItemStringWithError

2019-02-10 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Adding PyDict_GetItemStringWithError makes is possible to migrate existing code 
to a design that does not ignore errors.  I have a significant number of calls 
to PyDict_GetItemString that cannot be switch toed PyDict_GetItem without 
increasing the number of lines of C code I have to write (or in other words, if 
PyDict_GetItemString wouldn't exist I'd have invented this myself for use in 
extensions I write).

Another reason for adding the function is consistency in the API. 

BTW. I've added a function with the same signature as the proposed 
PyDict_GetItemStringWithError to my exension's code base, which is something 
I'd have to do anyway for backward compatibility with older CPython versions.

W.r.t API design: I prefer the interface of _PyObject_LookupAttr to that of 
PyDict_GetItemWithError, even if the additional cost of a call to 
PyErr_Occurred() is insignificant in most of my code (esp. when guarded with a 
test for a NULL return value from PyDict_GetItemWithError).

--

___
Python tracker 

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



[issue12317] inspect.getabsfile() is not documented

2019-02-10 Thread Dong-hee Na


Dong-hee Na  added the comment:

@terry.reedy
I submited the PR 11786 for this issue.
If you are okay can you take a look please?
Thanks!

--

___
Python tracker 

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



[issue35954] Incoherent type conversion in configparser

2019-02-10 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35954] Incoherent type conversion in configparser

2019-02-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue35954] Incoherent type conversion in configparser

2019-02-10 Thread Adeokkuw


Adeokkuw  added the comment:

Btw: The name "read_dict" [1] as well as its docstring say exactly the opposite 
of what it does. It acts as a "save_dict". Maybe that can be fixed on the go ...

The docstring

""" [...]
All types held in the dictionary are converted to strings during
reading, including section names, option names and keys. [...]
"""

actually implies what is my proposal here: Convert arguments to str during 
lookup as well.

```
def __getitem__(self, key):
if key != self.default_section and not self.has_section(key):
raise KeyError(key)
return self._proxies[key]
```

to

```
def __getitem__(self, key):

try: key = str(key)
except (WhateverError, IsRelevantHereError): raise KeyError(key)

if key != self.default_section and not self.has_section(key):
raise KeyError(key)
return self._proxies[key]
```

[1] https://github.com/python/cpython/blob/3.7/Lib/configparser.py

--

___
Python tracker 

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



[issue35954] Incoherent type conversion in configparser

2019-02-10 Thread Adeokkuw


New submission from Adeokkuw :

configparser interface implicitly converts all objects to str (read_dict [sic] 
on line 724 of "3.7/Lib/configparser.py") while saving but not while lookup 
(__getitem__ on line 956).

MWE:

```
config = configparser.ConfigParser()
config[123] = {}
print(config[123])
```
~> KeyError: 123

--
components: Library (Lib)
messages: 335150
nosy: Adeokkuw
priority: normal
severity: normal
status: open
title: Incoherent type conversion in configparser
type: behavior
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



[issue35953] crosscompilation fails with clang on android

2019-02-10 Thread muhzi


New submission from muhzi :

Trying to cross compile python for android using NDK r19. but I keep facing a 
linker error.

x86_64-linux-android21-clang -pie 
-L~/Android/Sdk/ndk-bundle/platforms/android-21/arch-x86_64/usr/lib64 -Xlinker 
-export-dynamic -o python \
Modules/python.o \
-L. -lpython2.7 -ldl-lm  
./libpython2.7.so: error: undefined reference to 'nl_langinfo'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

--

___
Python tracker 

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



[issue35953] crosscompilation fails with clang on android

2019-02-10 Thread muhzi


Change by muhzi :


--
components: Cross-Build
nosy: Alex.Willmer, muhzi
priority: normal
severity: normal
status: open
title: crosscompilation fails with clang on android
type: compile error
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



[issue35055] Error when we try to download the epub archive

2019-02-10 Thread Julien Palard


Julien Palard  added the comment:

@ned the issue with builds in 3.8 come from our use of column and row spanning 
in the 3.8 documentation, breaking the plain text builder. I fixed it in 
https://github.com/sphinx-doc/sphinx/pull/5559 which has to be release in march 
IIRC.

--
resolution:  -> third party
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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-10 Thread Francis MB


Francis MB  added the comment:

>> There may be better names for the flag.  "tie_goes_to_first_encountered" 
>> seemed a bit long though ;-)

Could it may be an alternative to set the mode tie case in a form like:

def mode(seq, *, case=CHOOSE_FIRST):
  [...]

(or TIE_CHOOSE_FIRST, ...) where CHOOSE_FIRST is an enum ?

Thanks!

--
nosy: +francismb

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Kumar Akshay

Kumar Akshay  added the comment:

Thanks @xtreak!
I've added a PR with the following API

➜  cpython git:(fix-issue-21269) ✗ ./python.exe
Python 3.8.0a0 (heads/fix-issue-21269-dirty:2433a2ab70, Feb 10 2019, 14:24:54)
[Clang 10.0.0 (clang-1000.10.44.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unittest.mock import Mock
>>> m = Mock()
>>> m(1, a=23)

>>> m.call_args
call(1, a=23)
>>> m.call_args.args #after this patch
(1,)
>>> m.call_args.kwargs   #after this patch
{'a': 23}
>>> m.call_args_list[0].args#after this patch
(1,)
>>> m.call_args_list[0].kwargs   #after this patch
{'a': 23}

--

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Kumar Akshay


Change by Kumar Akshay :


--
keywords: +patch, patch, patch
pull_requests: +11819, 11820, 11821
stage: needs patch -> patch review

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Kumar Akshay


Change by Kumar Akshay :


--
keywords: +patch
pull_requests: +11819
stage: needs patch -> patch review

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-10 Thread Kumar Akshay


Change by Kumar Akshay :


--
keywords: +patch, patch
pull_requests: +11819, 11820
stage: needs patch -> patch review

___
Python tracker 

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



[issue35924] curses segfault resizing window

2019-02-10 Thread SilentGhost


Change by SilentGhost :


--
nosy: +twouters

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-10 Thread Tal Einat


Tal Einat  added the comment:

After more thought, I agree that it isn't worth changing the current wording 
from "Actual" to something else.

--

___
Python tracker 

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