[issue37929] IDLE: OK sometimes fails to close configdialog

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15172
pull_request: https://github.com/python/cpython/pull/15485

___
Python tracker 

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



[issue37929] IDLE: OK sometimes fails to close configdialog

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15171
pull_request: https://github.com/python/cpython/pull/15484

___
Python tracker 

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



[issue37929] IDLE: OK sometimes fails to close configdialog

2019-08-24 Thread Tal Einat


Tal Einat  added the comment:


New changeset d4b4c00b57d24f6ee2cf3a96213406bb09953df3 by Tal Einat in branch 
'master':
bpo-37929: IDLE: avoid Squeezer-related config dialog crashes (GH-15452)
https://github.com/python/cpython/commit/d4b4c00b57d24f6ee2cf3a96213406bb09953df3


--

___
Python tracker 

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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Sergey Fedoseev


Sergey Fedoseev  added the comment:

$ gcc -v 2>&1 | grep 'gcc version'
gcc version 8.3.0 (Debian 8.3.0-19)

using ./configure --enable-optimizations --with-lto
$ python -m perf timeit -s "from collections import deque; consume = 
deque(maxlen=0).extend; b = bytes(2**20)" "consume(b)" 
--compare-to=../cpython-master/venv/bin/python
/home/sergey/tmp/cpython-master/venv/bin/python: . 6.71 ms 
+- 0.09 ms
/home/sergey/tmp/cpython-dev/venv/bin/python: . 6.71 ms +- 
0.08 ms
Mean +- std dev: [/home/sergey/tmp/cpython-master/venv/bin/python] 6.71 ms +- 
0.09 ms -> [/home/sergey/tmp/cpython-dev/venv/bin/python] 6.71 ms +- 0.08 ms: 
1.00x slower (+0%)

using ./configure --enable-optimizations
$ python -m perf timeit -s "from collections import deque; consume = 
deque(maxlen=0).extend; b = bytes(2**20)" "consume(b)" 
--compare-to=../cpython-master/venv/bin/python
/home/sergey/tmp/cpython-master/venv/bin/python: . 6.73 ms 
+- 0.17 ms
/home/sergey/tmp/cpython-dev/venv/bin/python: . 4.28 ms +- 
0.01 ms
Mean +- std dev: [/home/sergey/tmp/cpython-master/venv/bin/python] 6.73 ms +- 
0.17 ms -> [/home/sergey/tmp/cpython-dev/venv/bin/python] 4.28 ms +- 0.01 ms: 
1.57x faster (-36%)

--

___
Python tracker 

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



[issue37664] Update bundled pip and setuptools

2019-08-24 Thread Pradyun Gedam


Pradyun Gedam  added the comment:

Made the release and the PR. 

--

___
Python tracker 

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



[issue37664] Update bundled pip and setuptools

2019-08-24 Thread Pradyun Gedam


Change by Pradyun Gedam :


--
pull_requests: +15169
pull_request: https://github.com/python/cpython/pull/15483

___
Python tracker 

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



[issue37664] Update bundled pip and setuptools

2019-08-24 Thread Pradyun Gedam


Change by Pradyun Gedam :


--
pull_requests: +15168
pull_request: https://github.com/python/cpython/pull/15482

___
Python tracker 

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



[issue15542] Documentation incorrectly suggests __init__ called after direct __new__ call

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, the underlying code for this in Objects/typeobject.c::type_new().

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



Re: What make function with huge list so slow

2019-08-24 Thread Chris Angelico
On Sun, Aug 25, 2019 at 1:43 PM Windson Yang  wrote:
>
> Thank you, Chris. I tried your suggestions. I don't think that is the reason, 
> fib_dp_look() and fib_dp_set() which also allocation a big list can return in 
> 2s.

(Please don't top-post)

Are you running each function more than once, or just running them in
succession and seeing how long they take?

Show the full code you're using for the timing tests so we can recreate it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What make function with huge list so slow

2019-08-24 Thread Windson Yang
Thank you, Chris. I tried your suggestions. I don't think that is the
reason, fib_dp_look() and fib_dp_set() which also allocation a big list can
return in 2s.

Chris Angelico  于2019年8月25日周日 上午11:27写道:

> On Sun, Aug 25, 2019 at 12:56 PM Windson Yang  wrote:
> >
> > I have two functions to calculate Fibonacci numbers. fib_dp use a list to
> > store the calculated number. fib_dp2 just use two variables.
> >
> > def fib_dp(n):
> > if n <= 1:
> > return n
> > dp = [0] * (n+1)
> > dp[0], dp[1] = 0, 1
> > for i in range(2, n+1):
> > dp[i] = dp[i-1] + dp[i-2]
> > return dp[-1]
> >
> > def fib_dp2(n):
> > if n <= 1:
> > return n
> > pre, now = 0, 1
> > for i in range(2, (n+1)):
> > pre, now = now, pre+now
> > return now
> >
> > Theoretically, both of their time complexity should be O(n). However,
> when
> > the input n is so big (like 40), fib_dp2(40) can calculate it in
> 2s
> > but fib_dp(40) takes *more than 60s* (python3.7.3 and macOS 10.14.6).
> > Why?
>
> Memory allocation can take a long time. Try grabbing the line
> initializing dp and slapping that into the body of dp2, and then
> compare their times; that might make all the difference.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What make function with huge list so slow

2019-08-24 Thread Chris Angelico
On Sun, Aug 25, 2019 at 12:56 PM Windson Yang  wrote:
>
> I have two functions to calculate Fibonacci numbers. fib_dp use a list to
> store the calculated number. fib_dp2 just use two variables.
>
> def fib_dp(n):
> if n <= 1:
> return n
> dp = [0] * (n+1)
> dp[0], dp[1] = 0, 1
> for i in range(2, n+1):
> dp[i] = dp[i-1] + dp[i-2]
> return dp[-1]
>
> def fib_dp2(n):
> if n <= 1:
> return n
> pre, now = 0, 1
> for i in range(2, (n+1)):
> pre, now = now, pre+now
> return now
>
> Theoretically, both of their time complexity should be O(n). However, when
> the input n is so big (like 40), fib_dp2(40) can calculate it in 2s
> but fib_dp(40) takes *more than 60s* (python3.7.3 and macOS 10.14.6).
> Why?

Memory allocation can take a long time. Try grabbing the line
initializing dp and slapping that into the body of dp2, and then
compare their times; that might make all the difference.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue14619] Enhanced variable substitution for databases

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue19419] Use abc.ABC in the collections ABC

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This was done a long time ago.

--
resolution:  -> out of date
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



[issue37914] class timedelta, support the method hours and minutes in field accessors

2019-08-24 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
pull_requests: +15167
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15481

___
Python tracker 

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



What make function with huge list so slow

2019-08-24 Thread Windson Yang
I have two functions to calculate Fibonacci numbers. fib_dp use a list to
store the calculated number. fib_dp2 just use two variables.

def fib_dp(n):
if n <= 1:
return n
dp = [0] * (n+1)
dp[0], dp[1] = 0, 1
for i in range(2, n+1):
dp[i] = dp[i-1] + dp[i-2]
return dp[-1]

def fib_dp2(n):
if n <= 1:
return n
pre, now = 0, 1
for i in range(2, (n+1)):
pre, now = now, pre+now
return now

Theoretically, both of their time complexity should be O(n). However, when
the input n is so big (like 40), fib_dp2(40) can calculate it in 2s
but fib_dp(40) takes *more than 60s* (python3.7.3 and macOS 10.14.6).
Why?. At first, I guess the reasons are

1. It took too much time looking up the value in the list (the worse case
should be O(1) according to the document). However, the below function
fib_dp_tem(40) can finish in 2s, so looking up value should not be the
bottleneck.

def fib_dp_look(n):
if n <= 1:
return n
dp = [0] * (n+1)
dp[0], dp[1] = 0, 1
for i in range(2, n+1):
# change dp[i] to tem, this function is not correct now but it
return dp[-1] in 2s
tem = dp[i-1] + dp[i-2]
return dp[-1]

2. It took too much time setting up the value in the list (the worse case
should be O(1) according to the document). Again, the below function
fib_dp_set(40) can finish in 2s, so setting value should not be the
bottleneck too.

def fib_dp_set(n):
if n <= 1:
return n
dp = [0] * (n+1)
dp[0], dp[1] = 0, 1
for i in range(2, n+1):
 # this function is not correct now but it return dp[-1] in 2s
dp[i-1] = i
dp[i-2] = i + 1
return dp[-1]

3. python use some kind of cache for 'pre', 'now' variable, (like 'register
variable' in C, but I'm not sure how it work in CPython)

I also tried to use the dis module but with no luck. Any reason to make
fib_dp so much slower than fib_dp2?  Please let me know, thank you.

Bests,

Windson
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 21161d73d979012ec3b7247261178b3aa1555486 by Raymond Hettinger in 
branch '3.8':
[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
https://github.com/python/cpython/commit/21161d73d979012ec3b7247261178b3aa1555486


--

___
Python tracker 

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur that this should be closed.

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +15166
pull_request: https://github.com/python/cpython/pull/15480

___
Python tracker 

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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

At least some idlelib imports are delayed to avoid circular import errors, as 
described by Nick.

The patch adds 'Module level' before 'imports'.
Pro: techinically correct as only module level imports can be put at the top.
Com: might be seen as giving too much license to putting imports elsewhere.

Raymond, what do you think?  If you are not 'pro' enough to make the change, I 
think we should close.

--

___
Python tracker 

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset aef9ad82f7f667cd001a7112d3bc636e918626f7 by Raymond Hettinger in 
branch 'master':
bpo-37942: Improve argument clinic float converter (GH-15470)
https://github.com/python/cpython/commit/aef9ad82f7f667cd001a7112d3bc636e918626f7


--

___
Python tracker 

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



[issue20806] os.times document points to wrong section of non-Linux manual

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I opened a PR for this. @david please review.

--
nosy: +nanjekyejoannah
stage: patch review -> 

___
Python tracker 

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



[issue20806] os.times document points to wrong section of non-Linux manual

2019-08-24 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords: +patch
pull_requests: +15165
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15479

___
Python tracker 

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



[issue13341] Incorrect documentation for "u" PyArg_Parse format unit

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

This is has taken years but am curious, are we allowed to patch Python 2 given 
its EOL is almost due.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Since this is a PEP related issue, it should be moved to the PEP Github 
repository here : https://github.com/python/peps . If it still exists.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue16308] Undocumented (?) behaviour change in argparse from 3.2.3 to 3.3.0

2019-08-24 Thread paul j3


paul j3  added the comment:

https://bugs.python.org/issue26510

https://bugs.python.org/issue33109

There was some flip/flop over whether required should be true by default or not 
- the current behavior is False, (the 3.3.0)

The lasting change since this issue in 2012 is that `add_subparsers` now takes 
the 'required' parameter.  And this is documented.

To avoid the problem raising in this issue, the subparsers should be defined 
with:

p1 = parser.add_subparsers(required=True, dest='cmd')

The 'dest' parameter is documented, but that fact that it is needed with 
required=True is not.  Without it you can get an error when missing-argument is 
being formatted.  Without it the error formatter doesn't know what to call this 
argument.   I've mentioned this in one or more issues.

See my SO answer for discussion on this:

https://stackoverflow.com/questions/23349349/argparse-with-required-subparser/23354355#23354355

--

___
Python tracker 

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



Re: Newbie question about Python syntax

2019-08-24 Thread Cameron Simpson

On 24Aug2019 21:52, Paul St George  wrote:

Have you not got one of these handed to you from something?

Or are you right at the outside with some "opaque" blender handle or 
something? (Disclaimer: I've never used Blender.)


Thank you once again.
If I understand your question, I am right outside. By this I mean I 
have not created anything with Python. I have made the Blender model 
with the UI and am trying to use Python to read the values for the 
settings used. This has worked for all settings except this Map Value 
Node.


Hmm. So you have a CompositorNodeMapValue instance? If that is the case 
you should be able to inspect it as previously described.


However, it looks like this is something you construct in order to do 
some task. A little web searching turns up this stackexchange post:


 
https://blender.stackexchange.com/questions/42579/render-depth-map-to-image-with-python-script/42667

and some example code from an unrelated project:

 
https://github.com/panmari/stanford-shapenet-renderer/blob/master/render_blender.py


From the stackexchange post:


   map = tree.nodes.new(type="CompositorNodeMapValue")
   # Size is chosen kind of arbitrarily, try out until you're satisfied 
   # with resulting depth map.

   map.size = [0.08]
   map.use_min = True
   map.min = [0]
   map.use_max = True
   map.max = [255]

"tree" is "bpy.context.scene.node_tree".

Aside from "map" being a poor name (it is also a builtin Python 
function), it seems that one creates one of these to control how some 
rendering process is done.


The class reference page you originally cites then specifies the meaning 
of the various attributes you might set on one of these objects.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[issue18236] str.isspace should use the Unicode White_Space property

2019-08-24 Thread Greg Price


Greg Price  added the comment:

> I've gone and made a patch for this change

Update:

* The preparatory changes in #37760 are now almost all merged; GH-15265 is the 
one piece remaining, and I'd be grateful for a review.

It's a generally straightforward and boring change that converts the main data 
structures of makeunicodedata.py from using length-18 tuples as records to 
using a dataclass, which I think makes subsequent changes that add features to 
that script much easier both to write and to review.

* I have a slightly updated version of the fix itself, which differs mainly by 
adding a test: https://github.com/gnprice/cpython/commit/9b3bf6739 Comments 
welcome there too.

--

___
Python tracker 

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



[issue37636] Deprecate slicing and ordering operations on sys.version

2019-08-24 Thread Anthony Sottile


Anthony Sottile  added the comment:

I threw together a flake8 plugin which checks for these usage patterns:

https://github.com/asottile/flake8-2020


| Code   | Description |
||-|
| YTT101 | `sys.version[:...]` referenced (python3.10) |
| YTT102 | `sys.version[2]` referenced (python3.10)|
| YTT201 | `sys.version_info[0] == 3` referenced (python4) |
| YTT202 | `six.PY3` referenced (python4)  |
| YTT301 | `sys.version[0]` referenced (python10)  |

--

___
Python tracker 

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



[issue16308] Undocumented (?) behaviour change in argparse from 3.2.3 to 3.3.0

2019-08-24 Thread Ashwin Ramaswami


Ashwin Ramaswami  added the comment:

What's the status of this? Was paul.j3's patch ever reviewed?

--
nosy: +epicfaace

___
Python tracker 

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



[issue9253] argparse: optional subparsers

2019-08-24 Thread Ashwin Ramaswami


Change by Ashwin Ramaswami :


--
nosy: +epicfaace

___
Python tracker 

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



[issue15542] Documentation incorrectly suggests __init__ called after direct __new__ call

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Since this has taken long on the tracker, I just opened a PR with proposed 
changes from Aaron.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Greg Price


Greg Price  added the comment:

> Is there a particular reason to specifically call PyLong_FromSize_t? Seems 
> like PyLong_FromLong is the natural default (and what we default to in the 
> rest of the code), and it's what this ends up calling anyway.

Ah I see, the patch is meant to go on top of GH-15192, which makes 
PyLong_FromSize_t apply the small-int optimization itself.

As I just suggested on GH-15192, I'd like to see that PR apply the small-int 
optimization in the more broadly-used PyLong_FromUnsignedLong... and then I 
think the natural thing for this new function to do is to call that.

Still quite curious how LTO does, and also curious what compiler and flags 
you're using in benchmarks.

--

___
Python tracker 

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



[issue15542] Documentation incorrectly suggests __init__ called after direct __new__ call

2019-08-24 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords: +patch
pull_requests: +15164
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/15478

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-24 Thread Jens Troeger

Jens Troeger  added the comment:

Oops, forgot…

  >>> mimetypes.guess_extension("image/jpeg")  # Expected ".jpg" or ".jpeg"

as per referenced MDN. I personally would go with ".jpg" because that's the 
more common file name extension.

--

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-24 Thread Jens Troeger

New submission from Jens Troeger :

I think this one’s quite easy to reproduce:

  Python 3.7.4 (default, Jul 11 2019, 01:08:00) 
  [Clang 10.0.1 (clang-1001.0.46.4)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import mimetypes
  >>> mimetypes.guess_extension("image/jpg")  # Expected ".jpg"
  >>> mimetypes.guess_extension("image/jpeg")  # Expected ".jpg"
  '.jpe'

According to MDN

  
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

only "image/jpeg" is a valid MIME type; however, I’ve seen quite a bit of 
"image/jpg" out in the wild and I think that ought to be accounted for too.

Before I look into submitting a PR I wanted to confirm that this is an issue 
that ought to be fixed. I think it is.

--
components: Library (Lib)
messages: 350408
nosy: _savage
priority: normal
severity: normal
status: open
title: mimetypes.guess_extension() doesn’t get JPG right
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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Greg Price


Greg Price  added the comment:

Oh also:

* What compiler, and what compilation flags, are you using in your 
benchmarking?  That seems relevant :)

--

___
Python tracker 

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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Greg Price


Greg Price  added the comment:

Hmm, I'm a bit confused because:

* Your patch at GH-15251 replaces a number of calls to PyLong_FromLong with 
calls to the new _PyLong_FromUnsignedChar.

* That function, in turn, just calls PyLong_FromSize_t.

* And that function begins:

PyObject *
PyLong_FromSize_t(size_t ival)
{
PyLongObject *v;
size_t t;
int ndigits = 0;

if (ival < PyLong_BASE)
return PyLong_FromLong((long)ival);
// ...


* So, it seems like after your patch we still end up calling PyLong_FromLong at 
each of these callsites, just after a couple more indirections than before.

Given the magic of compilers and of hardware branch prediction, it wouldn't at 
all surprise me for those indirections to not make anything slower... but if 
the measurements are coming out *faster*, then I feel like something else must 
be going on. ;-)

Ohhh, I see -- I bet it's that at _PyLong_FromUnsignedChar, the compiler can 
see that `is_small_int(ival)` is always true, so the whole function just turns 
into get_small_int.  Whereas when compiling a call to PyLong_FromLong from some 
other file (other translation unit), it can't see that and can't make the 
optimization.

Two questions, then:

* How do the measurements look under LTO? I wonder if with LTO the linker is 
able to make the same optimization that this change helps the compiler make.

* Is there a particular reason to specifically call PyLong_FromSize_t? Seems 
like PyLong_FromLong is the natural default (and what we default to in the rest 
of the code), and it's what this ends up calling anyway.

--
nosy: +Greg Price

___
Python tracker 

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



[issue31956] Add start and stop parameters to the array.index()

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

There is a pending PR here : https://github.com/python/cpython/pull/4435 by 
phaqui. @phaqui do you want to finish your PR ?

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 805f8f9afea116c5d4d000570e3d02ae84502f43 by Raymond Hettinger 
(Berker Peksag) in branch 'master':
bpo-19072: Make @classmethod support chained decorators (GH-8405)
https://github.com/python/cpython/commit/805f8f9afea116c5d4d000570e3d02ae84502f43


--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you for the mentoring of this work. 
It was great experience for me!

--

___
Python tracker 

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



[issue18153] python imaplib - error 'unexpected response'

2019-08-24 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
title: python imaplib - error 'unexpected repsonse' -> python imaplib - error 
'unexpected response'

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Greg Price


Greg Price  added the comment:

> May I suggest directing your efforts towards fixing known bugs or 
> implementing requested features.

Well, I would certainly be grateful for a review on my fix to #18236. ;-) 
There's also a small docs bug at GH-15301.

I do think there's significant value in making code easier to read and less 
tricky. If the project continues to be successful for a long time to come, then 
that means the code will be read many, many more times than it's written. But 
one particular spot where it seems our experiences interestingly differ is:

> They are a bit tedious to review and are eating up our time in the back and 
> forth.

As a reviewer I generally find it much less work to review a change when it's 
intended to have no effect on the code's behavior. First, because it's easier 
to confirm no effect than to pin down what the effects are; then because the 
whole set of questions about whether the effects are desirable doesn't arise. 
As a result I often ask contributors (to Zulip, say) to split a change into a 
series of small pure refactors, followed by a very focused diff for the 
behavior change.

So that's certainly background to my sending as many PRs that don't change any 
behavior as PRs that do.

I actually have quite a number of draft changes built up over the last few 
weeks. I've held back on sending them all at once, partly because I've felt I 
have enough open PRs and I wanted to get a better sense of how reviews go. 
Perhaps I'll go pick out a couple more of them that are bugfixes, features, and 
docs to send next.

(You didn't mention docs just now, but given the care I see you take in adding 
to them and in revising What's New, I think we agree that work there is 
valuable.)

--

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Change by Kyle Stanley :


--
keywords: +needs review -patch

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Change by Kyle Stanley :


--
keywords: +patch
pull_requests: +15163
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15477

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> How do we identify whether or not set_wakeup_fd() is being called from a 
> non-main thread?

Never mind, I think I found the answer to my own question and tested a patch 
locally, I'll open a PR.

--

___
Python tracker 

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



Re: Newbie question about Python syntax

2019-08-24 Thread Barry
Have you tried asking on a blender user mailing list for help with this problem?

It seems that someone familiar with blender and its python interface should be 
able to help get you going.

Barry

> On 24 Aug 2019, at 20:52, Paul St George  wrote:
> 
>> On 24/08/2019 01:23, Cameron Simpson wrote:
>>> On 23Aug2019 13:49, Paul St George  wrote:
>>> Context:
>>> I am using Python to interrogate the value of some thing in Blender (just 
>>> as someone else might want to use Python to look at an email in a Mail 
>>> program or an image in Photoshop).
>>> 
>>> Assumptions:
>>> So, I want to look at the attribute of an instance of a class called 
>>> CompositorNodeMapValue. The code in the Python tutorial seems to be for 
>>> creating an instance of a class, but I assume Blender (in my case) has 
>>> already created the instance that I want to interrogate.
>> That would be the expectation. And to interrogate it, you need that instance 
>> to hand in a variable.
>>> Question:
>>> If this is so, should I find the code to get a list of the instances that 
>>> have been made (maybe using inspect?) and then, when I have its name, the 
>>> attributes of the one that interests me?
>> Have you not got one of these handed to you from something?
>> Or are you right at the outside with some "opaque" blender handle or 
>> something? (Disclaimer: I've never used Blender.)
> 
> Thank you once again.
> If I understand your question, I am right outside. By this I mean I have not 
> created anything with Python. I have made the Blender model with the UI and 
> am trying to use Python to read the values for the settings used. This has 
> worked for all settings except this Map Value Node.
> 
>> You can inspect objects with the inspect module. You can also be more 
>> direct. Given an object "o", you can do an assortment of things:
> 
> Before I do any of the following, I assume I need to use something like:
> 
> import struct
> class CompositorNodeMapValue(o):
> 
> I have tried this. Nothing happens. Not even an error. It's like waiting for 
> Godot.
> 
> I am guessing I am in the wrong namespace.
> 
> I don't know whether it is relevant, but I tried plain
> dir()
> and
> dir(struct)
> 
> They each returned a list and neither list had mention of 
> CompositorNodeMapValue
> 
> If I do something like:
> o = CompositorNodeMapValue()
> I get:
> NameError: name 'CompositorNodeMapValue' is not defined
> 
>> dir(o) gets a list of its attribute names.
>> help(o) prints out the docstring, somewhat rendered.
>> o.__dict__ is usually a dict mapping attribute names to their values.
>> type(o) gets you its type, so "print(type(o))" or "print(type(o).__name__)" 
>> can be handy.
>> A crude probe function (untested):
>>  def probe(o):
>>print(o)
>>for attr, value in sorted(o.__dict__.items()):
>>  print(" ", attr, type(value).__name__, value)
>> Enjoy,
>> Cameron Simpson  (formerly c...@zip.com.au)
>> "Are we alpinists, or are we tourists" followed by "tourists! tourists!"
>>- Kobus Barnard  in rec.climbing,
>>  on things he's heard firsthand
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37903] IDLE Shell sidebar.

2019-08-24 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-15474 with an implementation.

--

___
Python tracker 

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



[issue37903] IDLE Shell sidebar.

2019-08-24 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +15162
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/15474

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> Skipping this call for non-main thread in proactor implementation makes sense.

How do we identify whether or not set_wakeup_fd() is being called from a 
non-main thread?

--
nosy: +aeros167

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> May I suggest directing your efforts towards fixing known bugs or 
> implementing requested features.  It isn't our goal to create more work for 
> one another

There frequently is value in improving code readability, as it can improve 
maintainability in the long term, but I definitely understand your point.

--

___
Python tracker 

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



Re: Newbie question about Python syntax

2019-08-24 Thread Paul St George

On 24/08/2019 01:23, Cameron Simpson wrote:

On 23Aug2019 13:49, Paul St George  wrote:

Context:
I am using Python to interrogate the value of some thing in Blender 
(just as someone else might want to use Python to look at an email in 
a Mail program or an image in Photoshop).


Assumptions:
So, I want to look at the attribute of an instance of a class called 
CompositorNodeMapValue. The code in the Python tutorial seems to be 
for creating an instance of a class, but I assume Blender (in my case) 
has already created the instance that I want to interrogate.


That would be the expectation. And to interrogate it, you need that 
instance to hand in a variable.



Question:
If this is so, should I find the code to get a list of the instances 
that have been made (maybe using inspect?) and then, when I have its 
name, the attributes of the one that interests me?


Have you not got one of these handed to you from something?

Or are you right at the outside with some "opaque" blender handle or 
something? (Disclaimer: I've never used Blender.)


Thank you once again.
If I understand your question, I am right outside. By this I mean I have 
not created anything with Python. I have made the Blender model with the 
UI and am trying to use Python to read the values for the settings used. 
This has worked for all settings except this Map Value Node.




You can inspect objects with the inspect module. You can also be more 
direct. Given an object "o", you can do an assortment of things:


Before I do any of the following, I assume I need to use something like:

import struct
class CompositorNodeMapValue(o):

I have tried this. Nothing happens. Not even an error. It's like waiting 
for Godot.


I am guessing I am in the wrong namespace.

I don't know whether it is relevant, but I tried plain
dir()
and
dir(struct)

They each returned a list and neither list had mention of 
CompositorNodeMapValue


If I do something like:
o = CompositorNodeMapValue()
I get:
NameError: name 'CompositorNodeMapValue' is not defined



dir(o) gets a list of its attribute names.

help(o) prints out the docstring, somewhat rendered.

o.__dict__ is usually a dict mapping attribute names to their values.

type(o) gets you its type, so "print(type(o))" or 
"print(type(o).__name__)" can be handy.


A crude probe function (untested):

  def probe(o):
    print(o)
    for attr, value in sorted(o.__dict__.items()):
  print(" ", attr, type(value).__name__, value)

Enjoy,
Cameron Simpson  (formerly c...@zip.com.au)

"Are we alpinists, or are we tourists" followed by "tourists! tourists!"
    - Kobus Barnard  in rec.climbing,
  on things he's heard firsthand



--
https://mail.python.org/mailman/listinfo/python-list


[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Note, the argument clinic is already generating code like this for return 
values in "class double_return_converter".  For example,

_return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma);
if ((_return_value == -1.0) && PyErr_Occurred()) {
goto exit;
}

--

___
Python tracker 

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



[issue26093] __qualname__ different when calling generator object w/ functions.partial

2019-08-24 Thread Batuhan


Batuhan  added the comment:

This bug is fixed in 3.9 (probably in 3.8 too)

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +15161
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15470

___
Python tracker 

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


New submission from Raymond Hettinger :

The API for PyFloat_AsDouble() returns -1.0 to indicate an error.  
PyErr_Occurred() should only be called if there is a -1.0 return code.  This is 
the normal practice for those calls and it is a bit faster because it avoids 
unnecessary external call.

--
components: Argument Clinic
messages: 350395
nosy: larry, rhettinger
priority: normal
severity: normal
status: open
title: Generate correct error check for PyFloat_AsDouble
type: behavior
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks Terry.

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



[issue9634] Add timeout parameter to Queue.join()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It's been 4 1/2 years since last activity.  Marking as closed again due to lack 
of interest and due to the rarity of need.  Also we know that a person can 
already customize join() via a subclass.

--
resolution:  -> out of date
stage: needs patch -> 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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a8424940b4873791fc178a9f19a7bf1779a6cf42 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-14112: Allow beginners to explore shallowness in greater depth ;-) 
(GH-15465) (GH-15469)
https://github.com/python/cpython/commit/a8424940b4873791fc178a9f19a7bf1779a6cf42


--

___
Python tracker 

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



[issue24726] OrderedDict has strange behaviour when dict.__setitem__ is used.

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15160
pull_request: https://github.com/python/cpython/pull/15469

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 69ee87e99cfe0b79389cffa92d126af868baf353 by Raymond Hettinger in 
branch 'master':
bpo-14112: Allow beginners to explore shallowness in greater depth ;-) 
(GH-15465)
https://github.com/python/cpython/commit/69ee87e99cfe0b79389cffa92d126af868baf353


--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d5a66bc56f68d0f7cc3470722a31d7f731754af6 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453) 
(GH-15467)
https://github.com/python/cpython/commit/d5a66bc56f68d0f7cc3470722a31d7f731754af6


--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thank you again.  This was nice work.

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



[issue35235] Access violation on alloc in Windows x86-64 python, pymalloc_alloc

2019-08-24 Thread Victor Milovanov


Victor Milovanov  added the comment:

A bit more information: pool->freeblock for the broken pool looks like this:
0xXYZ?
while pool itself looks like this:
0x??XYZ000

--

___
Python tracker 

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



[issue37941] python -m and runpy.run_module set different __name__ by default

2019-08-24 Thread Julian Berman


New submission from Julian Berman :

This seems brutally simple, to the point where I'm concerned I'm missing 
something (or have seen this issue filed elsewhere but can't find it), but 
`python -m` and `runpy.run_module` don't set the same __name__ -- specifically 
`runpy.run_module`, when given a non-package, defaults to setting __name__ to 
`mod_name`.

So, given package/foo.py, with the "common"

`if __name__ == "__main__":` check at the bottom, `python -m package.foo` 
successfully executes, but `runpy.run_module("package.foo")` exits silently, 
unless explicitly passed `runpy.run_module("package.foo", run_name="__main__").

[n.b. pep517.{build,check} is a specific example of such a module that 
advertises itself as wanting to be executed via `python -m`]

issue16737 seems related but not exactly the same from what I can tell.

--
messages: 350387
nosy: Julian
priority: normal
severity: normal
status: open
title: python -m and runpy.run_module set different __name__ by default

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Eryk Sun


Eryk Sun  added the comment:

>\N{name}   : named character
>\U : 32-bit hexadecimal ordinal (e.g. \U0010)
>\u : 16-bit hexadecimal ordinal (e.g. \u)
>\xXX   : 8-bit hexadecimal ordinal (e.g. \xff)
>\OOO   : 9-bit octal ordinal (e.g. \777)
>\OO: 6-bit octal ordinal (e.g. \77)
>\O : 3-bit octal ordinal (e.g. \7)

Note that bytes literals do not implement \N, \U, and \u escape sequences -- 
e.g. b'\N{SPACE}' is literally just those 9 bytes, not b' '. Also, in bytes 
literals 9-bit octal sequences wrap around for the [256, 511] range -- e.g. 
b'\400' ==  b'\000' == b'\x00' and b'\777' == b'\377' == b'\xff'. I don't know 
whether the latter is intentional. I'd prefer for the compiler to raise a 
syntax error in this case. Asking for a byte value in the range [256, 511] is 
nonsense.

--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



Re: https://test.pypi.org/ internal server error

2019-08-24 Thread Manfred Lotz
On Sat, 24 Aug 2019 14:12:38 +0200
Manfred Lotz  wrote:

> I want to exercise how to create a package and upload it to pyi. So, I
> registered with https://test.pypi.org/. 
> 
> Now, when I click on
> https://test.pypi.org/manage/account/#account-emails to verify my
> email address I get an internal server error.
> 
> Same when I try https://test.pypi.org/manage/account/.
> 
> What is the proper place to report the problem?
> 

For the records. In the meantime the internal server error has been
fixed.


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 0ad85681de639792751ea53ec964d87d4ad45d71 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-32118:  Simplify docs for sequence comparison (GH-15450) (#15466)
https://github.com/python/cpython/commit/0ad85681de639792751ea53ec964d87d4ad45d71


--

___
Python tracker 

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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 8ad22a42267d4ecb1c080d420933680cc126363e by Raymond Hettinger 
(Dong-hee Na) in branch 'master':
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453)
https://github.com/python/cpython/commit/8ad22a42267d4ecb1c080d420933680cc126363e


--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15159
pull_request: https://github.com/python/cpython/pull/15467

___
Python tracker 

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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15158
pull_request: https://github.com/python/cpython/pull/15466

___
Python tracker 

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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset edd21129dd304e178ca8be82ba689488dfb58276 by Raymond Hettinger in 
branch 'master':
bpo-32118:  Simplify docs for sequence comparison (GH-15450)
https://github.com/python/cpython/commit/edd21129dd304e178ca8be82ba689488dfb58276


--

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +15157
pull_request: https://github.com/python/cpython/pull/15465

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Eryk Sun


Eryk Sun  added the comment:

As Karthikeyan noted, in a regular string literal, backslash is an escape 
character that's used in the following escape sequences:

\N{name}   : named character
\U : 32-bit hexadecimal ordinal (e.g. \U0010)
\u : 16-bit hexadecimal ordinal (e.g. \u)
\xXX   : 8-bit hexadecimal ordinal (e.g. \xff)
\OOO   : 9-bit octal ordinal (e.g. \777)
\OO: 6-bit octal ordinal (e.g. \77)
\O : 3-bit octal ordinal (e.g. \7)

\a : \x07, \N{BEL}, \N{ALERT}
\b : \x08, \N{BS}, \N{BACKSPACE}
\t : \x09, \N{HT}, \N{TAB}, \N{CHARACTER TABULATION}, \N{HORIZONTAL 
TABULATION}
\n : \x0a, \N{LF}, \N{NL}, \N{LINE FEED}, \N{NEW LINE}
\v : \x0b, \N{VT}, \N{LINE TABULATION}, \N{VERTICAL TABULATION}
\f : \x0c, \N{FF}, \N{FORM FEED}
\r : \x0d, \N{CR}, \N{CARRIAGE RETURN}
\" : \x22, \N{QUOTATION MARK}
\' : \x27, \N{APOSTROPHE}
\\ : \x5c, \N{REVERSE SOLIDUS}

For a Windows path, either we can use a normal string literal with backslash 
path separators escaped by doubling them or we can use a raw string literal. 

One corner case with a raw string literal is that it can't end with an odd 
number of backslashes. We can address this in one of two ways. Either rely on 
the compiler's implicit concatenation of string literals, or rely on the 
system's path normalization to collapse multiple path separators (except at the 
beginning of a path). For example:

>>> print(r'C:\Users' '\\')
C:\Users\
>>> print(r'C:\Users\\')
C:\Users\\

The system normalizes the second case to collapse repeated backslashes. For 
example:

>>> print(os.path._getfullpathname(r'C:\Users\\'))
C:\Users\
>>> os.path.samefile(r'C:\Users\\', r'C:\Users' '\\')
True

We can also use forward slash as the path separator for file-system paths (but 
not registry paths), such as paths that we're passing to open() or os 
functions. I don't recommend this if a file-system path is to be passed as a 
command-line argument. Some programs use forward slash as a switch for 
command-line options. In this case first normalize the path via 
os.path.normpath, or via replace('/', '\\').

In some cases a path may be returned to us in Windows with a "\\?\" prefix 
(backslash only), which is sometimes referred to as an extended path. (More 
specifically, it's a native path in the device namespace.) This tells the 
Windows API to skip path normalization. If a path begins with exactly this 
prefix, then appending components to it with forward slash results in a path 
that will not work. Use os.path.join, or normalize the path via 
os.path.normpath to ensure the final path uses only backslash as the path 
separator.

--
nosy: +eryksun

___
Python tracker 

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



[issue37754] Consistency of Unix's shared_memory implementation with windows

2019-08-24 Thread Vinay Sharma


Vinay Sharma  added the comment:

Also, shm_open returns an integer file descriptor.
And when this file descriptor is passed too fcntl.flock (in macOS) it throws 
the following error:
OSError: [Errno 45] Operation not supported

Whereas, the same code works fine on linux.

Therefore, I have doubts whether Macos flock implementation support locking 
shared_memory files.

--

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 5e63ab05f114987478a21612d918a1c0276fe9d2 by Raymond Hettinger 
(Greg Price) in branch 'master':
bpo-37812: Convert CHECK_SMALL_INT macro to a function so the return is 
explicit. (GH-15216)
https://github.com/python/cpython/commit/5e63ab05f114987478a21612d918a1c0276fe9d2


--

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue37754] Consistency of Unix's shared_memory implementation with windows

2019-08-24 Thread Vinay Sharma


Vinay Sharma  added the comment:

Hi,
I just opened a PR implementing a fix very similar to your suggestions. I am 
using advisory locking using fcntl.flock.
And I am locking on file descriptors.
If you see my PR, in resource tracker I am opening a file 
"/dev/shm/", and trying to acquire exclusive lock on the same.
And it's working great on Linux.
Since, resource_tracker is spawned as a different process, I can't directly use 
file descriptors.

But macOS doesn't have any memory mapped files created by shm_open in /dev/shm. 
In fact, it doesn't store any reference to memory mapped files in the 
filesystem.

Therefore it get's difficult to get the file descriptor in resource tracker.
Also, is there a good way to pass file descriptors between processes.

Any ideas on the above issue will be much appreciated.

--
title: Persistence of Shared Memory Segment after process exits -> Consistency 
of Unix's shared_memory implementation with windows

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I noticed a very similar story in CHECK_BINOP.

How about we don't do any more of these :-)

I understand the desire to have an explicit return but don't think these minor 
aesthetics are worth it.  The existing code was correct. The patches increase 
the total code volume.  There are subtle differences during the transformation 
(macros don't require type declarations). They are a bit tedious to review and 
are eating up our time in the back and forth. All changes like this risk 
introducing bugs into otherwise correct code.  Minor code churn is rarely worth 
it.

May I suggest directing your efforts towards fixing known bugs or implementing 
requested features.  It isn't our goal to create more work for one another ;-)

--

___
Python tracker 

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



[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-24 Thread Stefan Behnel


Stefan Behnel  added the comment:

Sounds like a good idea to add something like this.

Have a look here for some more ideas:
https://github.com/lxml/lxml/blob/master/tools/xpathgrep.py

ElementTree should be able to provide most of these features as well these days.

--
stage:  -> needs patch

___
Python tracker 

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



[issue33694] test_asyncio: test_start_tls_server_1() fails on Python on x86 Windows7 3.7 and 3.x

2019-08-24 Thread Srinivas Nyayapati


Change by Srinivas Nyayapati :


--
pull_requests: +15156
pull_request: https://github.com/python/cpython/pull/15170

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks very much shireenrao for the PR, which is now merged with Python 3.8+. 
I've additionally backported the fix to zipp in 0.6.0.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset c410f381bf66c48d84812e19e3ba7c2878511a3e by Jason R. Coombs (Miss 
Islington (bot)) in branch '3.8':
bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)
https://github.com/python/cpython/commit/c410f381bf66c48d84812e19e3ba7c2878511a3e


--

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15155
pull_request: https://github.com/python/cpython/pull/15461

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset a4e2991bdc993b60b6457c8a38d6e4a1fc845781 by Jason R. Coombs 
(shireenrao) in branch 'master':
bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)
https://github.com/python/cpython/commit/a4e2991bdc993b60b6457c8a38d6e4a1fc845781


--

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I guess '\f' translates to \x0c and using raw string helps with this.

>>> ord('\f')
12
>>> '\f'
'\x0c'
>>> var = "d:\stuff\morestuff\furtherdown\THEFILE.txt"
>>> var
'd:\\stuff\\morestuff\x0curtherdown\\THEFILE.txt'
>>> print(os.path.normpath(var))
d:\stuff\morestuff
  urtherdown\THEFILE.txt
>>> os.path.normpath(var)
'd:\\stuff\\morestuff\x0curtherdown\\THEFILE.txt'

# Use raw string

>>> var = r"d:\stuff\morestuff\furtherdown\THEFILE.txt"
>>> var
'd:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'
>>> print(os.path.normpath(var))
d:\stuff\morestuff\furtherdown\THEFILE.txt
>>> os.path.normpath(var)
'd:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'

# Or escape back slashes

>>> var = "d:\\stuff\\morestuff\\furtherdown\\THEFILE.txt"
>>> var
'd:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'
>>> print(os.path.normpath(var))
d:\stuff\morestuff\furtherdown\THEFILE.txt

--
nosy: +xtreak

___
Python tracker 

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



[issue37754] Persistence of Shared Memory Segment after process exits

2019-08-24 Thread Vinay Sharma


Change by Vinay Sharma :


--
keywords: +patch
pull_requests: +15154
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15460

___
Python tracker 

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



[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-24 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Now that XML has pretty print option with issue14465 would it be handy to add a 
command line tool pretty printer similar to json.tool? This can be written as 
one-liner similar to json pretty printing but I think it's a good option and 
having a command line tool also helps in piping the output to other commands 
like filtering particular tags. I tried searching mailing list and couldn't 
find any discussions along these lines. There were some concerns around using 
external tools and  in https://bugs.python.org/issue14465#msg324098 . I thought 
to open this to gather feedback.

Branch : https://github.com/tirkarthi/cpython/tree/bpo14465-xml-tool


python -m xml.tool /tmp/person.xml

  
Idly
  
  
Dosa
  


# Get all breakfast tags

python -m xml.tool /tmp/person.xml | grep breakfast
Idly
Dosa

--
components: Library (Lib)
messages: 350372
nosy: eli.bendersky, rhettinger, scoder, serhiy.storchaka, xtreak
priority: normal
severity: normal
status: open
title: Add xml.tool to pretty print XML like json.tool
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Yugi


New submission from Yugi :

I was trying to handle path to work on both '/' and '\' but when I tried to run 
the code like they said on: 
https://stackoverflow.com/questions/3167154/how-to-split-a-dos-path-into-its-components-in-python
I have no idea why the terminal on my PC doesnt have the same output like 
everybody was discussing at the time the questions and answers were posted.
OS: ubuntu 16.04 LTS, Intel Core i5-7500, 16GB/1TB, Intel HD Graphics 630
python version: 3.5.2
I borrowed a mac pro 2015 to check if it had the same output like my PC but it 
had not. my friend has python 3.7.1 installed and the output is: 
['d:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'] (on my PC, it is: 
['d:\\stuff\\morestuff\x0curtherdown\\THEFILE.txt']). I'm totally new to Python 
and I'm very sorry if this issue is already reported. Thank you!

--
files: Screenshot from 2019-08-24 21-41-52.png
messages: 350371
nosy: Yugi
priority: normal
severity: normal
status: open
title: os.path.normpath change some characters of a path into kinda 'hex number'
type: behavior
versions: Python 3.5
Added file: https://bugs.python.org/file48560/Screenshot from 2019-08-24 
21-41-52.png

___
Python tracker 

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



[issue37797] Add name attribute to NameError

2019-08-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -15147

___
Python tracker 

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



https://test.pypi.org/ internal server error

2019-08-24 Thread Manfred Lotz
I want to exercise how to create a package and upload it to pyi. So, I
registered with https://test.pypi.org/. 

Now, when I click on https://test.pypi.org/manage/account/#account-emails
to verify my email address I get an internal server error.

Same when I try https://test.pypi.org/manage/account/.

What is the proper place to report the problem?

-- 
Manfred

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19867] pickletools.OpcodeInfo.code is a string

2019-08-24 Thread Batuhan


Batuhan  added the comment:

What should we do then, close?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37925] --embed not included in python3.8-config usage/--help

2019-08-24 Thread Batuhan


Change by Batuhan :


--
keywords: +patch
pull_requests: +15153
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15458

___
Python tracker 

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



[issue37664] Update bundled pip and setuptools

2019-08-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Added lukasz since last beta is by Monday.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue37938] refactor PyLong_As*() functions

2019-08-24 Thread Sergey Fedoseev


New submission from Sergey Fedoseev :

PyLong_As*() functions have a lot of duplicated code, creating draft PR with 
attempt to deduplicate them.

--
components: Interpreter Core
messages: 350367
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: refactor PyLong_As*() functions

___
Python tracker 

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



[issue36946] Possible signed integer overflow in slice handling

2019-08-24 Thread Batuhan


Batuhan  added the comment:

Should we close this?

--
nosy: +BTaskaya

___
Python tracker 

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



  1   2   >