[issue37764] email.Message.as_string infinite loop

2019-09-04 Thread Ashwin Ramaswami


Ashwin Ramaswami  added the comment:

Should we get a CVE for this because this is a security issue?

--

___
Python tracker 

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



[issue38035] shared_semaphores cannot be shared across unrelated processes

2019-09-04 Thread Vinay Sharma


New submission from Vinay Sharma :

Currently, shared semaphores can only be created, and existing semaphores can't 
be opened. Shared semaphores are opened using the following command.
```
sem_open(name, O_CREAT | O_EXCL, 0600, val)
```
This will raise error if a semaphore which already exists.
This behaviour works well when the file descriptors of these semaphores can be 
shared with children processes.

But, it doesn't work when an unrelated process which needs access to shared 
semaphore tries to open it.

--
components: Library (Lib)
messages: 351176
nosy: vinay0410
priority: normal
severity: normal
status: open
title: shared_semaphores cannot be shared across unrelated processes
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



[issue38035] shared_semaphores cannot be shared across unrelated processes

2019-09-04 Thread Vinay Sharma


Change by Vinay Sharma :


--
type:  -> enhancement

___
Python tracker 

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



Re: How do I give a decorator acces to the class of a decorated function

2019-09-04 Thread dieter
Antoon Pardon  writes:
> What I am trying to do is the following.
>
> class MyClass (...) :
> @register
> def MyFunction(...)
> ...
>
> What I would want is for the register decorator to somehow create/mutate
> class variable(s) of MyClass.
>
> Is that possible or do I have to rethink my approach?

As others have already explained: the decoration works an the
function (not the method) level. A function knows nothing of a class.

Others have already pointed out work arounds.
I add an additional one:
Instead of:
  class C:
...
@decorate
def f(...): ...
...
you can use:
  class C:
...
def f(...): ...
...
  decorate(C, C.f)

In Python 2, "C.f" returns a method (an object with a
reference to the class and the function) - there, you would
not need the class parameter for "decorate".
In Python 3, however, "C.f" is the function (without any reference
to the class.

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


[issue38026] inspect.getattr_static should avoid dynamic lookup

2019-09-04 Thread Inada Naoki


Change by Inada Naoki :


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



[issue38026] inspect.getattr_static should avoid dynamic lookup

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset bdcbb83c6640c2b30d0e1a2a497e9ba34cc53b26 by Miss Islington (bot) 
in branch '3.8':
bpo-38026: fix inspect.getattr_static (GH-15676)
https://github.com/python/cpython/commit/bdcbb83c6640c2b30d0e1a2a497e9ba34cc53b26


--
nosy: +miss-islington

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-09-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thanks for the patch.  More IDLE patches would be welcome should you want to 
attack something else.

Possible browser scrolling refinements:

1. Scroll by an integral number of labels.  This is easy with text.  For our 
synthesized tree, we would have to calculate the # of canvas pixels to scroll.  
However, if we switch to ttk.Treeview (#31552), it, like Text has a height in 
lines.  So its yview method might scroll in line units, like text.

2. Only bind wheel event(s) used on system?  Should test on 3 systems. Do all 
*nix other than  tk for macOS use X-window buttons?  Not a big deal.

3. Use bindtags to bind wheel events just once. Then unbind when shutdown?  
(Check if unbind elsewhere.)

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



[issue38026] inspect.getattr_static should avoid dynamic lookup

2019-09-04 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 8f9cc8771ffb8d0e21be287eaed42ae06087acca by Inada Naoki in branch 
'master':
bpo-38026: fix inspect.getattr_static (GH-15676)
https://github.com/python/cpython/commit/8f9cc8771ffb8d0e21be287eaed42ae06087acca


--

___
Python tracker 

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



[issue38026] inspect.getattr_static should avoid dynamic lookup

2019-09-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15349
pull_request: https://github.com/python/cpython/pull/15692

___
Python tracker 

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



[issue37764] email.Message.as_string infinite loop

2019-09-04 Thread Abhilash Raj


Change by Abhilash Raj :


--
resolution:  -> fixed

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset 16af39aa84cc3553c51d57461964ab4e28029184 by Miss Islington (bot) 
in branch '3.7':
bpo-37902: IDLE: Add scrolling for IDLE browsers. (GH-15368)
https://github.com/python/cpython/commit/16af39aa84cc3553c51d57461964ab4e28029184


--

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset 9c2654d1aa85968fede1b888fba86aebc06c5be6 by Miss Islington (bot) 
in branch '3.8':
bpo-37902: IDLE: Add scrolling for IDLE browsers. (GH-15368)
https://github.com/python/cpython/commit/9c2654d1aa85968fede1b888fba86aebc06c5be6


--
nosy: +miss-islington

___
Python tracker 

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



Re: pandas loc on str lower for column comparison

2019-09-04 Thread Sayth Renshaw
On Sunday, 1 September 2019 10:48:54 UTC+10, Sayth Renshaw  wrote:
> I've created a share doc same structure anon data from my google drive.
> 
> https://drive.google.com/file/d/0B28JfFTPNr_lckxQRnFTRF9UTEFYRUVqRWxCNVd1VEZhcVNr/view?usp=sharing
> 
> Sayth

I tried creating the df1 dataframe by using iloc instead of loc to avoid any 
column naming issues.

So i created a list of integers for iloc representing the columns in current 
example.

df1 = df.iloc[[0,1,5,6,7]] 

However, I ust be misunderstanding the docs 
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc
Allowed inputs are:

An integer, e.g. 5.
A list or array of integers, e.g. [4, 3, 0].

Because while it works I appear to grab all columns 13 when I requested 5.
UID NameFTE Agent IDCurrent Leader  New Leader  
Current TeamNew TeamCurrent SiteNew SiteUnnamed: 10 
Unnamed: 11 Unnamed: 12 

How do I misunderstand iloc?

Thanks,
Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38033] Use After Free: PyObject_Free (valgrind)

2019-09-04 Thread Tim Peters


Tim Peters  added the comment:

You're probably chasing ghosts ;-)  Please read about what needs to be done to 
use valgrind successfully with Python:

https://github.com/python/cpython/blob/master/Misc/README.valgrind

--
nosy: +tim.peters
title: Use After Free: PyObject_Free -> Use After Free: PyObject_Free (valgrind)

___
Python tracker 

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



[issue35939] Remove urllib.parse._splittype from mimetypes.guess_type

2019-09-04 Thread Dong-hee Na


Dong-hee Na  added the comment:

This issue is fixed by
https://github.com/python/cpython/pull/15522

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread Dong-hee Na


Change by Dong-hee Na :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-09-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15348
pull_request: https://github.com/python/cpython/pull/15690

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-09-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15347
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/15689

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread Dong-hee Na


Dong-hee Na  added the comment:

Great! I will close bpo-35939 also.

--

___
Python tracker 

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



[issue37902] Add scrolling for IDLE browsers

2019-09-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 2cd902585815582eb059e3b40e014ebe4e7fdee7 by Terry Jan Reedy 
(GeeTransit) in branch 'master':
bpo-37902: IDLE: Add scrolling for IDLE browsers. (#15368)
https://github.com/python/cpython/commit/2cd902585815582eb059e3b40e014ebe4e7fdee7


--

___
Python tracker 

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



[issue38033] Use After Free: PyObject_Free

2019-09-04 Thread Chiaki Ishikawa


Chiaki Ishikawa  added the comment:

I found that the inlined functions are used by other functions and resulted in 
similar issues. Once obmalloc.c is fixed, I think such problems are 
automatically fixed.

--

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread Abhilash Raj


Abhilash Raj  added the comment:

I think so, yes.

Also, while you are at it, can you also close bpo-35939 with a comment that 
points to this issue and the right PR for the fix?

--

___
Python tracker 

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



[issue38033] Use After Free: PyObject_Free

2019-09-04 Thread Chiaki Ishikawa


Chiaki Ishikawa  added the comment:

PyMem_Free and PyMem_Realloc also suffer from similar "Use After Free" issue.

The standard version of Python3.7 interpreter does not seem to have debug 
symbol and so I installed a debug version of it. Now it seems to have a shadow 
symbol of inlined function so that we can now learn the line numbers of 
functions where the problem occurs in more detail. I am attaching the  valgrind 
log excerpts for PyObj_Free, PyObj_Realloc, PyMem_Free, PyMem_Realloc, etc.

Sorry for piecemeal reporting. The earlier messages swamp the log very 
verbosely and so I had to disable the reporting one by one.

PS: There seem to be cases where the result of reading uninitialized value is 
used for conditional testing, too.

--
Added file: https://bugs.python.org/file48593/PyMem_Free.txt

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread Dong-hee Na


Dong-hee Na  added the comment:

@vstinner(my mentor) @maxking
Now this issue is solved.
I'd like to close this issue. Is it okay?

--
nosy: +maxking, vstinner

___
Python tracker 

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



[issue38034] Typo on logging.handlers.QueueListener documentation

2019-09-04 Thread wuck


New submission from wuck :

There appears to be a typo on the documentation page for 
logging.handlers.QueueListener at 
https://docs.python.org/3/library/logging.handlers.html#logging.handlers.QueueListener

The line "Changed in version 3.5: The respect_handler_levels argument was 
added." should instead refer to "Changed in version 3.5: The 
respect_handler_level argument was added.", removing the 's' at the end of 
respect_handler_level.

--
assignee: docs@python
components: Documentation
messages: 351161
nosy: docs@python, wuck
priority: normal
severity: normal
status: open
title: Typo on logging.handlers.QueueListener documentation
versions: Python 3.5, Python 3.6, Python 3.7, 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



[issue37764] email.Message.as_string infinite loop

2019-09-04 Thread Abhilash Raj


Change by Abhilash Raj :


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



[issue37764] email.Message.as_string infinite loop

2019-09-04 Thread Abhilash Raj


Abhilash Raj  added the comment:


New changeset 6ad0a2c45f78020f7994e47620c1cf7b225f8197 by Abhilash Raj in 
branch '3.8':
[3.8] bpo-37764: Fix infinite loop when parsing unstructured email headers. 
(GH-15239) (GH-15686)
https://github.com/python/cpython/commit/6ad0a2c45f78020f7994e47620c1cf7b225f8197


--

___
Python tracker 

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



[issue38031] FileIO.__init__ aborts when opener returns bad fd

2019-09-04 Thread Zackery Spytz


Zackery Spytz  added the comment:

Thank you for the report.

--
components: +Interpreter Core
nosy: +ZackerySpytz
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset 8873bff2871078e9f23e6c7d942d3a8edbd0921f by Miss Islington (bot) 
(Dong-hee Na) in branch '3.7':
[3.7] bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs 
(GH-15522) (GH-15687)
https://github.com/python/cpython/commit/8873bff2871078e9f23e6c7d942d3a8edbd0921f


--

___
Python tracker 

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



[issue38031] FileIO.__init__ aborts when opener returns bad fd

2019-09-04 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset 6d7a786d2e4b48a6b50614e042ace9ff996f0238 by Miss Islington (bot) 
in branch '3.8':
bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs 
(GH-15522)
https://github.com/python/cpython/commit/6d7a786d2e4b48a6b50614e042ace9ff996f0238


--

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +15345
pull_request: https://github.com/python/cpython/pull/15687

___
Python tracker 

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



[issue37764] email.Message.as_string infinite loop

2019-09-04 Thread Abhilash Raj


Change by Abhilash Raj :


--
pull_requests: +15344
pull_request: https://github.com/python/cpython/pull/15686

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15343
pull_request: https://github.com/python/cpython/pull/15685

___
Python tracker 

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset 87bd2071c756188b6cd577889fb1682831142ceb by Miss Islington (bot) 
(Dong-hee Na) in branch 'master':
bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs 
(GH-15522)
https://github.com/python/cpython/commit/87bd2071c756188b6cd577889fb1682831142ceb


--
nosy: +miss-islington

___
Python tracker 

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



[issue38033] Use After Free: PyObject_Free

2019-09-04 Thread Chiaki Ishikawa


Chiaki Ishikawa  added the comment:

Addtion:

PyObject_Realloc also has the issue of Use After Free: this may be more serious.


==31128== Invalid read of size 4
==31128==at 0x5A48CA: PyObject_Realloc (in /usr/bin/python3.7)
==31128==by 0x5DD8FB: _PyBytes_Resize (in /usr/bin/python3.7)
==31128==by 0x4F53BC: ??? (in /usr/bin/python3.7)
==31128==by 0x5D9A22: _PyMethodDef_RawFastCallKeywords (in 
/usr/bin/python3.7)
==31128==by 0x54C75F: ??? (in /usr/bin/python3.7)
==31128==by 0x5537DA: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54FA9B: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x54D0A1: _PyEval_EvalCodeWithName (in /usr/bin/python3.7)
==31128==by 0x5DA6E1: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54FA9B: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x54D0A1: _PyEval_EvalCodeWithName (in /usr/bin/python3.7)
==31128==by 0x5DA6E1: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54C61F: ??? (in /usr/bin/python3.7)
==31128==by 0x5537DA: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x54D0A1: _PyEval_EvalCodeWithName (in /usr/bin/python3.7)
==31128==by 0x54F3F2: PyEval_EvalCode (in /usr/bin/python3.7)
==31128==by 0x6313D1: ??? (in /usr/bin/python3.7)
==31128==by 0x631486: PyRun_FileExFlags (in /usr/bin/python3.7)
==31128==by 0x6320EE: PyRun_SimpleFileExFlags (in /usr/bin/python3.7)
==31128==by 0x653EED: ??? (in /usr/bin/python3.7)
==31128==by 0x65424D: _Py_UnixMain (in /usr/bin/python3.7)
==31128==by 0x4ACB09A: (below main) (libc-start.c:308)
==31128==  Address 0x5b21020 is 32,208 bytes inside a block of size 32,801 
free'd
==31128==at 0x4835259: realloc (vg_replace_malloc.c:834)
==31128==by 0x5A49AB: PyObject_Realloc (in /usr/bin/python3.7)
==31128==by 0x5DD8FB: _PyBytes_Resize (in /usr/bin/python3.7)
==31128==by 0x4F53BC: ??? (in /usr/bin/python3.7)
==31128==by 0x5D9A22: _PyMethodDef_RawFastCallKeywords (in 
/usr/bin/python3.7)
==31128==by 0x54C75F: ??? (in /usr/bin/python3.7)
==31128==by 0x5537DA: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54FA9B: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x54D0A1: _PyEval_EvalCodeWithName (in /usr/bin/python3.7)
==31128==by 0x5DA6E1: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54FA9B: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x54D0A1: _PyEval_EvalCodeWithName (in /usr/bin/python3.7)
==31128==by 0x5DA6E1: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54C61F: ??? (in /usr/bin/python3.7)
==31128==by 0x5537DA: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x5DA3EB: _PyFunction_FastCallKeywords (in /usr/bin/python3.7)
==31128==by 0x54F8FB: _PyEval_EvalFrameDefault (in /usr/bin/python3.7)
==31128==by 0x54D0A1: _PyEval_EvalCodeWithName (in /usr/bin/python3.7)
==31128==by 0x54F3F2: PyEval_EvalCode (in /usr/bin/python3.7)
==31128==by 0x6313D1: ??? (in /usr/bin/python3.7)
==31128==by 0x631486: PyRun_FileExFlags (in /usr/bin/python3.7)
==31128==by 0x6320EE: PyRun_SimpleFileExFlags (in /usr/bin/python3.7)
==31128==by 0x653EED: ??? (in /usr/bin/python3.7)
==31128==by 0x65424D: _Py_UnixMain (in /usr/bin/python3.7)
==31128==by 0x4ACB09A: (below main) (libc-start.c:308)
==31128==  Block was alloc'd at
==31128==at 0x4832E13: malloc (vg_replace_malloc.c:307)
==31128==by 0x5DE3AA: PyBytes_FromStringAndSize (in /usr/bin/python3.7)
==31128==by 0x4F5375: ??? (in /usr/bin/python3.7)
==31128==by 0x5D9A22: _PyMethodDef_RawFastCallKeywords (in 

[issue38033] Use After Free: PyObject_Free

2019-09-04 Thread Chiaki Ishikawa


New submission from Chiaki Ishikawa :

Hi, 
I am new to Python bug tracker, so my setting of the fields may be inadequate. 
If so, apologies in advance.
I think Use After Free bug is a potential security issue and so wanted to 
report ASAP.

First my environment: I am using Debian GNU/Linux, and its kernel version is: 
uname -a output, 
SMP Debian 4.19.37-6 (2019-07-18) x86_64 GNU/Linux

Python version is:
# python3 --version
Python 3.7.4

mozilla thunderbird mail client testing framework uses
python as a test driver, and when I was checking the local build of thunderbird 
under a test suite invoked from |make mozmill| under valgrind (a memory usage 
checker), the first thing I noticed is the following message from valgrind.
PyObject_Free seems to access a memory location (4 octets) in an already freed 
block. This happened many times during the test.

I have not bothered to look into the source code of python, but a seasoned 
developer should be able to figure out where such reference is made.

>From valgrind log:

==30354== Invalid read of size 4
==30354==at 0x5A29FE: PyObject_Free (in /usr/bin/python3.7)
==30354==by 0x5B7337: ??? (in /usr/bin/python3.7)
==30354==by 0x5BBBFF: PyDict_SetItem (in /usr/bin/python3.7)
==30354==by 0x58DE19: PyType_Ready (in /usr/bin/python3.7)
==30354==by 0x6482A0: _Py_ReadyTypes (in /usr/bin/python3.7)
==30354==by 0x63551A: _Py_InitializeCore_impl (in /usr/bin/python3.7)
==30354==by 0x6357AA: _Py_InitializeCore (in /usr/bin/python3.7)
==30354==by 0x5E17EC: ??? (in /usr/bin/python3.7)
==30354==by 0x653D88: ??? (in /usr/bin/python3.7)
==30354==by 0x65424D: _Py_UnixMain (in /usr/bin/python3.7)
==30354==by 0x4ACB09A: (below main) (libc-start.c:308)
==30354==  Address 0x4c8b020 is 16 bytes after a block of size 576 free'd
==30354==at 0x4833FC0: free (vg_replace_malloc.c:538)
==30354==by 0x5B7337: ??? (in /usr/bin/python3.7)
==30354==by 0x5BBBFF: PyDict_SetItem (in /usr/bin/python3.7)
==30354==by 0x58DE19: PyType_Ready (in /usr/bin/python3.7)
==30354==by 0x6482A0: _Py_ReadyTypes (in /usr/bin/python3.7)
==30354==by 0x63551A: _Py_InitializeCore_impl (in /usr/bin/python3.7)
==30354==by 0x6357AA: _Py_InitializeCore (in /usr/bin/python3.7)
==30354==by 0x5E17EC: ??? (in /usr/bin/python3.7)
==30354==by 0x653D88: ??? (in /usr/bin/python3.7)
==30354==by 0x65424D: _Py_UnixMain (in /usr/bin/python3.7)
==30354==by 0x4ACB09A: (below main) (libc-start.c:308)
==30354==  Block was alloc'd at
==30354==at 0x4832E13: malloc (vg_replace_malloc.c:307)
==30354==by 0x5A4B16: PyObject_Malloc (in /usr/bin/python3.7)
==30354==by 0x5B72BD: ??? (in /usr/bin/python3.7)
==30354==by 0x5BBBFF: PyDict_SetItem (in /usr/bin/python3.7)
==30354==by 0x58DE19: PyType_Ready (in /usr/bin/python3.7)
==30354==by 0x6482A0: _Py_ReadyTypes (in /usr/bin/python3.7)
==30354==by 0x63551A: _Py_InitializeCore_impl (in /usr/bin/python3.7)
==30354==by 0x6357AA: _Py_InitializeCore (in /usr/bin/python3.7)
==30354==by 0x5E17EC: ??? (in /usr/bin/python3.7)
==30354==by 0x653D88: ??? (in /usr/bin/python3.7)
==30354==by 0x65424D: _Py_UnixMain (in /usr/bin/python3.7)
==30354==by 0x4ACB09A: (below main) (libc-start.c:308)
==30354==


TIA

--
components: Library (Lib)
messages: 351154
nosy: zephyrus00jp
priority: normal
severity: normal
status: open
title: Use After Free: PyObject_Free
type: security
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



[issue38032] lib2to3 doesn't parse Python 3 identifiers containing non-spacing marks

2019-09-04 Thread Justin ARthur

New submission from Justin ARthur :

Python 3 code with an identifier that has a non-spacing mark in it does not get 
tokenized by lib2to3 and will result in an exception thrown in the parsing 
process.

Parsing the attached file (badvar.py), results in `ParseError: bad token: 
type=58, value='̇', context=('', (1, 1))`

This happens because the Name pattern regular expression in lib2to3 is `r'\w+'` 
and the word character class doesn't contain non-spacing marks (and possible 
other [continuation characters allowed in Python 3 
identifiers](https://docs.python.org/3/reference/lexical_analysis.html#identifiers)).

(reported by energizer in the Python IRC channel)

--
components: 2to3 (2.x to 3.x conversion tool), Library (Lib)
files: badvar.py
messages: 351153
nosy: JustinTArthur
priority: normal
severity: normal
status: open
title: lib2to3 doesn't parse Python 3 identifiers containing non-spacing marks
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file48592/badvar.py

___
Python tracker 

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



Re: Formatting floating point

2019-09-04 Thread DL Neil via Python-list

On 5/09/19 5:12 AM, Dave via Python-list wrote:
...

My question is why, and where do I find a reliable source of information 
on formatting numbers?  Not interested in replacement values like '{} 
{}'.format(1, 2).



Agreed: there's ton(ne)s of information 'out there', much of it old, eg 
Python2, "formatter" (deprecated since v3.4), methods pre-dating 
f-strings, etc; and more of it rather casually thrown-out-there. 
Learning from StackOverflow (etc) has its limits/perils!


Authoritative Python docs: https://docs.python.org/3/
The "Mini-Language": 
https://docs.python.org/3/library/string.html#formatspec


Current advice (v3.6+) is to study the newer f-strings (formally 
"formatted string literals"): 
https://docs.python.org/3/tutorial/inputoutput.html which came from PEP 
498: https://www.python.org/dev/peps/pep-0498/


--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread miss-islington


miss-islington  added the comment:


New changeset cad7abf8abe657b696b9c8deb4b727e0cefaf36d by Miss Islington (bot) 
in branch '3.8':
bpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)
https://github.com/python/cpython/commit/cad7abf8abe657b696b9c8deb4b727e0cefaf36d


--
nosy: +miss-islington

___
Python tracker 

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



[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread Steve Dower


Change by Steve Dower :


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



[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15342
pull_request: https://github.com/python/cpython/pull/15682

___
Python tracker 

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



[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread Steve Dower


Steve Dower  added the comment:


New changeset 772ec0fad57412daa53d16d7019b6b2fe6e94942 by Steve Dower in branch 
'master':
bpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)
https://github.com/python/cpython/commit/772ec0fad57412daa53d16d7019b6b2fe6e94942


--

___
Python tracker 

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



[issue38031] FileIO.__init__ aborts when opener returns bad fd

2019-09-04 Thread Maxwell Bernstein


New submission from Maxwell Bernstein :

On a debug build, the following causes an abort:

import _io
_io.FileIO("foobar", opener=lambda name, flags: 100)

100 is not a valid fd. FileIO attempts to raise an IOError from errno, but 
there is already an exception set when PyErr_SetFromErrno uses PyObject_Call to 
create the exception.

--
components: IO
messages: 351150
nosy: tekknolagi
priority: normal
severity: normal
status: open
title: FileIO.__init__ aborts when opener returns bad fd
type: crash
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



[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue37858] CookieLib: MozillaCookieJar.py uses case-sensitive regex to validate cookies file

2019-09-04 Thread Ned Deily


Change by Ned Deily :


--
versions:  -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread Steve Dower


Change by Steve Dower :


--
assignee:  -> steve.dower

___
Python tracker 

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



[issue38030] os.stat fails for block devices such as //./PhysicalDrive0

2019-09-04 Thread Eryk Sun


New submission from Eryk Sun :

In issue 37834, I posted a suggest implementation of win32_xstat_impl that 
included the following snippet of code:

if (!GetFileInformationByHandle(hFile, )) {
error = GetLastError();
if (error != ERROR_INVALID_PARAMETER &&
error != ERROR_INVALID_FUNCTION &&
error != ERROR_NOT_SUPPORTED) {
retval = -1;
goto cleanup;
}
/* Volumes and physical disks are block devices, e.g.
   \\.\C: and \\.\PhysicalDrive0. */
memset(result, 0, sizeof(*result));
result->st_mode = 0x6000; /* S_IFBLK */
goto cleanup;
}

This is meant to handle the above errors. We know we have FILE_TYPE_DISK. If 
GetFileInformationByHandle fails with one of the above error codes, then we 
must have a disk or volume device without a mounted file-system device. This 
should be reported as a block device.

However it was changed in the final version as follows:

if (!GetFileInformationByHandle(hFile, )) {
switch (GetLastError()) {
case ERROR_INVALID_PARAMETER:
case ERROR_INVALID_FUNCTION:
case ERROR_NOT_SUPPORTED:
retval = -1;
goto cleanup;
}
/* Volumes and physical disks are block devices, e.g.
   \\.\C: and \\.\PhysicalDrive0. */
memset(result, 0, sizeof(*result));
result->st_mode = 0x6000; /* S_IFBLK */
goto cleanup;
}

Now it's failing on the errors that should be handled, and succeeding on all 
other errors that should fail. If we want to use a switch statement here, I 
suggest the following:

if (!GetFileInformationByHandle(hFile, )) {
switch (GetLastError()) {
case ERROR_INVALID_PARAMETER:
case ERROR_INVALID_FUNCTION:
case ERROR_NOT_SUPPORTED:
/* Volumes and physical disks are block devices, e.g.
   \\.\C: and \\.\PhysicalDrive0. */
memset(result, 0, sizeof(*result));
result->st_mode = 0x6000; /* S_IFBLK */
goto cleanup;
}
retval = -1;
goto cleanup;
}

--
components: IO, Windows
messages: 351149
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: high
severity: normal
stage: needs patch
status: open
title: os.stat fails for block devices such as //./PhysicalDrive0
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



Re: How to remove a string from a txt file?

2019-09-04 Thread Tobiah

On 9/4/19 8:08 AM, Spencer Du wrote:

Hi

I want to remove a string from a txt file and then print out what I have 
removed. How do I do this.

The txt file is in this format and should be kept in this format.

txt.txt:
laser,cameras,

Thanks



Do you want to remove one of the fields by using an argument?  Like:

my_py_solution txt.txt cameras

Its not clear what you are trying to achieve.



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


Re: How to remove a string from a txt file?

2019-09-04 Thread DL Neil via Python-list

On 5/09/19 3:08 AM, Spencer Du wrote:

Hi

I want to remove a string from a txt file and then print out what I have 
removed. How do I do this.

The txt file is in this format and should be kept in this format.

txt.txt:
laser,cameras,


Is this a homework assignment?

What code do you have so far?

How to identify the beginning of the sub-string to be removed?

How to identify the end of the sub-string?

How does one "remove a string" AND "kept in this format"?

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to remove a string from a txt file?

2019-09-04 Thread Joel Goldstick
On Wed, Sep 4, 2019 at 11:11 AM Spencer Du  wrote:
>
> Hi
>
> I want to remove a string from a txt file and then print out what I have 
> removed. How do I do this.
>
> The txt file is in this format and should be kept in this format.
>
> txt.txt:
> laser,cameras,
>
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list

read the file line by line.  if it doesn't contain your string, write
it to a new file.  for each line, use string functions to find the
string you want to remove.  One way is to split on ',' or use
csvreader to get a list of words between comma.  Print the one you
like and join the values on each side of the text you are looking for.
Write that to a file

Lather, rinse and repeat

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37858] CookieLib: MozillaCookieJar.py uses case-sensitive regex to validate cookies file

2019-09-04 Thread Ashley Harvey


Change by Ashley Harvey :


--
pull_requests: +15340
pull_request: https://github.com/python/cpython/pull/15680

___
Python tracker 

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



[issue37858] CookieLib: MozillaCookieJar.py uses case-sensitive regex to validate cookies file

2019-09-04 Thread Ashley Harvey


Change by Ashley Harvey :


--
pull_requests: +15339
pull_request: https://github.com/python/cpython/pull/15679

___
Python tracker 

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



[issue37858] CookieLib: MozillaCookieJar.py uses case-sensitive regex to validate cookies file

2019-09-04 Thread Ashley Harvey


Change by Ashley Harvey :


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

___
Python tracker 

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



[issue37934] Docs: Clarify NotImplemented use cases

2019-09-04 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> As you say, we currently have only one usage of NotImplemented outside its 
> intended purpose.

I know at least 3 in CPython, so it's not so rare to use NotImplemented for 
something else than binary operators:
1. __subclasshook__
2. reducer_override (in pickling)
3. __length_hint__

> Of course, you might argue that _once Python has NotImplemented_, it can be 
> used elsewhere - but as I said, I don't think it should be encouraged.

I'm not saying that it should be actively encouraged, but the documentation 
shouldn't be limited to just one use case. Given that NotImplemented exists, 
why shouldn't it be used in more cases to indicate that an operation is not 
implemented?

--

___
Python tracker 

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



CVE-2019-9636 - Can this be exploit over the wire?

2019-09-04 Thread Barry Scott
I have been looking into CVE-2019-9636 and I'm not sure that
python code that works in bytes is vulnerable to this.

The "trick" that to make the CVE dangerous assumes that you
have a unicode string with \uff03 (FULLWIDTH NUMBER SIGN')
that under NFKC turns into '#'.

The discussion in https://bugs.python.org/issue36216 all the explaination
starts with  unicode string.

What I'm interested in what happens if you get the URL as part of a HTML page or
other mechanism.

To that end I made a URL that if the vulnerability is triggered will change 
which search
engine is visited.

b'http://google.xn--combing-xr93b.com/fred'

And when I use urlsplit() I get this:

print( urlparse.urlsplit('http://google.xn--combing-xr93b.com/fred') )
SplitResult(scheme='http', netloc='google.xn--combing-xr93b.com', 
path='/fred', query='', fragment='')


The netloc is still IDNA encoded so the "trick" did not trigger.
If code then uses that netloc its going to fail to return anything as no
domain name registrar should have register a name with illegal \uff03 in it.

Also this raises an exception:

'google.xn--combing-xr93b.com'.decode('idna')

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.7/encodings/idna.py", line 193, in decode
result.append(ToUnicode(label))
  File "/usr/lib64/python2.7/encodings/idna.py", line 139, in ToUnicode
raise UnicodeError("IDNA does not round-trip", label, label2)
UnicodeError: ('IDNA does not round-trip', 'xn--combing-xr93b', 
'com#bing')

The conclusion I reached is that the CVE only applies to client code that 
allows a URL
in unicode to be entered.

Have I missed something important in the analysis?

Barry

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


Re: Formatting floating point

2019-09-04 Thread Dave via Python-list

On 9/4/19 1:38 PM, Rhodri James wrote:

On 04/09/2019 18:12, Dave via Python-list wrote:
My question is why, and where do I find a reliable source of 
information on formatting numbers?  Not interested in replacement 
values like '{} {}'.format(1, 2).


Here: 
https://docs.python.org/3/library/string.html#format-specification-mini-language 



I suspect the thing you were overlooking was that format() expects to be 
given a format specification, and you gave it a format string.  Instead 
of format(num, "{0:.1f}"), you wanted format(num, ".1f").  If you had 
tried "{0:.1f}".format(num) instead, you would have found that worked too.



Thanks Rhodri

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


[issue38021] pep425 tag for AIX is inadequate

2019-09-04 Thread Michael Felt


Change by Michael Felt :


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

___
Python tracker 

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



Re: Formatting floating point

2019-09-04 Thread Dave via Python-list

On 9/4/19 1:25 PM, Chris Angelico wrote:

On Thu, Sep 5, 2019 at 3:16 AM Dave via Python-list
 wrote:


All,

I have been going in circles trying to format a floating point number so
there is only 1 decimal place.  In reading all of the gobble-gook that
passes for Python advice, it looked like I should have done this:

numStr = '3.14159'
num = float(numstr) # OK so far
numFmt = format(num, '{0:.1f}') # Errors on format string
# --- Alternative that also does not work
numFmt = float("{0:.1f}".format(numStr))
# ---
numFmt = format(num, '0.1f')# Does work



Let's start by eliminating a few possibilities here. Don't try
formatting the original string, and don't call float() on the result
afterwards; just start with a floating-point value, and then create a
formatted string. If you think about starting with a value (which in
this case is a number) and the need to make a displayable version
(which implies that it's a string), your options basically look like
this:

num = 3.14159
num_fmt = format(num, ".1f")
num_fmt = "{0:.1f}".format(num)
num_fmt = f"{num:.1f}"

All of these will give you back the string "3.1". All of them involve
a format string of ".1f", and they differ only in how they're choosing
which value to put there.

Hopefully that will clear things up a bit.

ChrisA



That helps!  Thanks Chris.

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


[issue38014] Python 3.7 does not compile

2019-09-04 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



Re: Formatting floating point

2019-09-04 Thread Rhodri James

On 04/09/2019 18:12, Dave via Python-list wrote:
My question is why, and where do I find a reliable source of information 
on formatting numbers?  Not interested in replacement values like '{} 
{}'.format(1, 2).


Here: 
https://docs.python.org/3/library/string.html#format-specification-mini-language


I suspect the thing you were overlooking was that format() expects to be 
given a format specification, and you gave it a format string.  Instead 
of format(num, "{0:.1f}"), you wanted format(num, ".1f").  If you had 
tried "{0:.1f}".format(num) instead, you would have found that worked too.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Formatting floating point

2019-09-04 Thread Chris Angelico
On Thu, Sep 5, 2019 at 3:16 AM Dave via Python-list
 wrote:
>
> All,
>
> I have been going in circles trying to format a floating point number so
> there is only 1 decimal place.  In reading all of the gobble-gook that
> passes for Python advice, it looked like I should have done this:
>
> numStr = '3.14159'
> num = float(numstr) # OK so far
> numFmt = format(num, '{0:.1f}') # Errors on format string
> # --- Alternative that also does not work
> numFmt = float("{0:.1f}".format(numStr))
> # ---
> numFmt = format(num, '0.1f')# Does work
>

Let's start by eliminating a few possibilities here. Don't try
formatting the original string, and don't call float() on the result
afterwards; just start with a floating-point value, and then create a
formatted string. If you think about starting with a value (which in
this case is a number) and the need to make a displayable version
(which implies that it's a string), your options basically look like
this:

num = 3.14159
num_fmt = format(num, ".1f")
num_fmt = "{0:.1f}".format(num)
num_fmt = f"{num:.1f}"

All of these will give you back the string "3.1". All of them involve
a format string of ".1f", and they differ only in how they're choosing
which value to put there.

Hopefully that will clear things up a bit.

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


[issue37245] Azure Pipeline 3.8 CI: multiple tests hung and timed out on macOS 10.13

2019-09-04 Thread Ned Deily


Ned Deily  added the comment:

Yeah, I agree that increasing the timeout shouldn't be the answer here. I still 
have never seen failure modes like this when running my own tests.  The idea 
about CPUs is one worth pursuing although I usually run with -j3.  Also I 
wonder how much memory the VM is configured with.  Any way we can find out 
number of cpus and memory easily?

--

___
Python tracker 

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



Formatting floating point

2019-09-04 Thread Dave via Python-list

All,

I have been going in circles trying to format a floating point number so 
there is only 1 decimal place.  In reading all of the gobble-gook that 
passes for Python advice, it looked like I should have done this:


numStr = '3.14159'
num = float(numstr) # OK so far
numFmt = format(num, '{0:.1f}') # Errors on format string
# --- Alternative that also does not work
numFmt = float("{0:.1f}".format(numStr))
# ---
numFmt = format(num, '0.1f')# Does work

My question is why, and where do I find a reliable source of information 
on formatting numbers?  Not interested in replacement values like '{} 
{}'.format(1, 2).


Thanks,
Dave

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


[issue37245] Azure Pipeline 3.8 CI: multiple tests hung and timed out on macOS 10.13

2019-09-04 Thread Steve Dower


Steve Dower  added the comment:

> Maybe macOS on Azure is running slower and we should just increase the 
> timeout?

(Aside, why don't the macOS buildbots have a tag saying that? Took me ages to 
find them...)

I doubt it's running 6-7x slower. More likely something is causing one of the 
workers to crash at a point where the lock remains held instead of being 
released (I saw this at work the other week in a slightly different context, 
but same symptoms).

Could os._exit() at the wrong time cause it?

It also looks like Azure is running tests with 4 processes, but the buildbot 
(at least the one I'm looking at) is only using 2. So perhaps there are more 
conflicts from that?

--

___
Python tracker 

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



[issue37970] urllib.parse docstrings incomplete

2019-09-04 Thread Zachary Ware


Zachary Ware  added the comment:

I see.  I don't think we need to describe each returned component in the 
docstring; they're some combination of self-explanatory, described in the 
reference docs, or just industry-standard terms that are easily defined from 
other sources.  I'm not suggesting to add anything to the docstring about the 
`scheme` return component, but rather the *scheme* argument (which is the 
default value for the `scheme` return component when it's not found in the 
*url*).  The subcomponents of netloc should be mentioned because the docstring 
currently gives the impression that the user has to parse them out for 
themselves, which is not true.

Off the top of my head, I'd suggest changing the `urlsplit` docstring to 
something like:

```
Parse *url* and return a SplitResult.

SplitResult is a named 5-tuple of the following components:
:///?#

The ``username``, ``password``, ``hostname``, and ``port``
sub-components of ``netloc`` can also be accessed as
attributes of the SplitResult object.

The *scheme* argument provides the default value of the
``scheme`` component when no scheme is found in *url*.

If *allow_fragments* is False, no attempt is made to
separate the ``fragment`` component from the previous
component, which can be either ``path`` or ``query``.

Note that % escapes are not expanded.
```

--
nosy: +orsenthil

___
Python tracker 

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



[issue38028] Assertion error in Python 3.8

2019-09-04 Thread Ned Deily


Ned Deily  added the comment:

The traceback you provide in the first message:

  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/wheel.py",
 line 324, in move_wheel_files
scheme = distutils_scheme(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/locations.py",
 line 104, in distutils_scheme
assert not (home and prefix), "home={} prefix={}".format(home, prefix)
AssertionError: home=/private/tmp/pip-target-4p5evqc_ 
prefix=/private/tmp/pip-build-env-b27ru_1v/overlay

shows a reference to a Distutils data structure.  As I noted above, NumPy has 
(or at least it used to have) its own customized version of Distutils.  So that 
seems quite likely to be due to some incompatibility between the two versions 
of Distutil. 

And, in any case, if it were to be determined that there is a problem with pip 
or setuptools or cython, each of those projects has its own issue tracker.  
Again, you should start with the NumPy project since they are the ones who make 
all these pieces work together by providing NumPy's build and installation 
scripts.

--
status: open -> closed

___
Python tracker 

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



[issue37245] Azure Pipeline 3.8 CI: multiple tests hung and timed out on macOS 10.13

2019-09-04 Thread STINNER Victor


STINNER Victor  added the comment:

> I'm still seeing this, maybe 1 in 20 builds, so it's semi-random. A new 
> deadlock, maybe?

It seems like only the jobs on Azure are killed by timeout. The jobs on macOS 
buildbots look fine. Maybe macOS on Azure is running slower and we should just 
increase the timeout?

The bug still occurs:

https://github.com/python/cpython/pull/15651
https://dev.azure.com/Python/cpython/_build/results?buildId=49786=results

0:49:27 load avg: 1.41 [419/419/6] test_threading crashed (Exit code 1)

6 tests failed:
test_concurrent_futures test_functools test_importlib
test_multiprocessing_forkserver test_multiprocessing_spawn
test_threading

The whole job was killed after 57 minutes.

--

___
Python tracker 

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



[issue38021] pep425 tag for AIX is inadequate

2019-09-04 Thread Michael Felt


Michael Felt  added the comment:

Thank you Ned.

Not a justification perhaps, but a way to specify that it is support. Three+ 
years ago when I first worked on something for Lib/ctypes to get find_library() 
et al working for AIX I was also asked to add it as _aix.py similar to the 
macos support (with, iirc is more than just a single file) being separate from 
util.py. 

To me, it just seemed that is the way it is done to keep maintenance of the 
core (external) code cleaner. 

After I post the PR I welcome your perspective on the sense or nonsense of 
having a separate _xxx_support.py file (where _xxx could be any platform, not 
merely osx or aix.

--

___
Python tracker 

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



[issue9938] Add optional kwargs to argparse

2019-09-04 Thread hai shi


Change by hai shi :


--
nosy: +rhettinger

___
Python tracker 

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



[issue38028] Assertion error in Python 3.8

2019-09-04 Thread Ana

Ana  added the comment:

Well I have been looking through the interim commands running by the terminal. 
As far as I can see that’s not Numpy/scipy or whatever.

These are the setup tools, wheel and Cython. I may be wrong, but I guess these 
are pretty universal and are required by many functionalities of Python

sudo -H /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip
 install --ignore-installed --no-user --prefix 
/private/tmp/pip-build-env-b27ru_1v/overlay --no-warn-script-location 
--no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 
setuptools wheel cython
Password:
Collecting setuptools
  Using cached 
https://files.pythonhosted.org/packages/b2/86/095d2f7829badc207c893dd4ac767e871f6cd547145df797ea26baea4e2e/setuptools-41.2.0-py2.py3-none-any.whl
Collecting wheel
  Using cached 
https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl
Collecting cython
Installing collected packages: setuptools, wheel, cython

The error appeared right after running that command. So, is it still a Numpy 
issue?

> On 4 Sep 2019, at 19:10, Ned Deily  wrote:
> 
> 
> Ned Deily  added the comment:
> 
> NumPy has a very complex build and install process including supplying its 
> own modified version of Distutils.  You should take up any build and install 
> issues first with the NumPy project and then, if you both agree that there 
> appears to be a problem in Python itself, re-open an issue here.  We really 
> are not in a position to debug NumPy installs here.
> 
> --
> resolution:  -> third party
> stage:  -> resolved
> type: crash -> 
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



Re: Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-04 Thread Chris Angelico
On Thu, Sep 5, 2019 at 2:07 AM Israel Brewster  wrote:
>
> >
> > On Sep 3, 2019, at 11:09 AM, Israel Brewster  wrote:
> >
> >>
> >> On Sep 3, 2019, at 10:49 AM, Peter Otten <__pete...@web.de> wrote:
> >>
> >> Israel Brewster wrote:
> >>
> >>> When using pool.imap to apply a function over a list of values, what is
> >>> the proper way to pass additional arguments to the function, specifically
> >>> in my case a Queue that the process can use to communicate back to the
> >>> main thread (for the purpose of reporting progress)? I have seen
> >>> suggestions of using starmap, but this doesn’t appear to have a “lazy”
> >>> variant, which I have found to be very beneficial in my use case. The
> >>> Queue is the same one for all processes, if that makes a difference.
> >>>
> >>> I could just make the Queue global, but I have always been told not too.
> >>> Perhaps this is an exception?
> >>
> >> How about wrapping the function into another function that takes only one
> >> argument? A concise way is to do that with functools.partial():
> >>
> >> def f(value, queue): ...
> >>
> >> pool.imap(partial(f, queue=...), values)
> >
> > That looks like exactly what I was looking for. I’ll give it a shot. Thanks!
>
> So as it turns out, this doesn’t work after all. I get an error stating that 
> “Queue objects should only be shared between processes through inheritance”. 
> Still a good technique to know though!
>

Globals aren't as bad as some people think. In this case, a
module-level variable seems like the correct way to do things.

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


[issue38028] Assertion error in Python 3.8

2019-09-04 Thread Ned Deily


Ned Deily  added the comment:

NumPy has a very complex build and install process including supplying its own 
modified version of Distutils.  You should take up any build and install issues 
first with the NumPy project and then, if you both agree that there appears to 
be a problem in Python itself, re-open an issue here.  We really are not in a 
position to debug NumPy installs here.

--
resolution:  -> third party
stage:  -> resolved
type: crash -> 

___
Python tracker 

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



[issue38029] Should io.TextIOWrapper raise an error at instantiation if a StringIO is passed as 'buffer'?

2019-09-04 Thread Brian Skinn


New submission from Brian Skinn :

If I read the docs correctly, io.TextIOWrapper is meant to provide a str-typed 
interface to an underlying bytes stream.

If a TextIOWrapper is instantiated with the underlying buffer=io.StringIO(), it 
breaks:

>>> import io
>>> tw = io.TextIOWrapper(io.StringIO())
>>> tw.write(b'abcd\n')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: write() argument must be str, not bytes
>>> tw.write('abcd\n')
5
>>> tw.read()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: string argument expected, got 'bytes'
>>> tw.read(1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: underlying read() should have returned a bytes-like object, not 'str'



Would it be better for TextIOWrapper to fail earlier, at instantiation-time, 
for this kind of (unrecoverably?) broken type mismatch?

--
components: Library (Lib)
messages: 351139
nosy: bskinn
priority: normal
severity: normal
status: open
title: Should io.TextIOWrapper raise an error at instantiation if a StringIO is 
passed as 'buffer'?
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



[issue38028] Assertion error in Python 3.8

2019-09-04 Thread Steve Dower


Change by Steve Dower :


--
nosy: +Marcus.Smith, dstufft, ncoghlan, paul.moore, pradyunsg

___
Python tracker 

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



[issue38028] Assertion error in Python 3.8

2019-09-04 Thread Ana


New submission from Ana :

After all, I am trying to install the dev version of Numpy and the other libs. 
Unfortunately, I am still unable to install them. I have some assertion errors:

ERROR: Exception:
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py",
 line 188, in main
status = self.run(options, args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/install.py",
 line 398, in run
installed = install_given_reqs(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/req/__init__.py",
 line 54, in install_given_reqs
requirement.install(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/req/req_install.py",
 line 925, in install
self.move_wheel_files(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/req/req_install.py",
 line 453, in move_wheel_files
wheel.move_wheel_files(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/wheel.py",
 line 324, in move_wheel_files
scheme = distutils_scheme(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/locations.py",
 line 104, in distutils_scheme
assert not (home and prefix), "home={} prefix={}".format(home, prefix)
AssertionError: home=/private/tmp/pip-target-4p5evqc_ 
prefix=/private/tmp/pip-build-env-b27ru_1v/overlay

That's the first time I see such an issue and googling doesn't resolve it at all

--
components: macOS
messages: 351138
nosy: annelischen, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Assertion error in Python 3.8
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



Re: Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-04 Thread Israel Brewster
> 
> On Sep 3, 2019, at 11:09 AM, Israel Brewster  wrote:
> 
>> 
>> On Sep 3, 2019, at 10:49 AM, Peter Otten <__pete...@web.de> wrote:
>> 
>> Israel Brewster wrote:
>> 
>>> When using pool.imap to apply a function over a list of values, what is
>>> the proper way to pass additional arguments to the function, specifically
>>> in my case a Queue that the process can use to communicate back to the
>>> main thread (for the purpose of reporting progress)? I have seen
>>> suggestions of using starmap, but this doesn’t appear to have a “lazy”
>>> variant, which I have found to be very beneficial in my use case. The
>>> Queue is the same one for all processes, if that makes a difference.
>>> 
>>> I could just make the Queue global, but I have always been told not too.
>>> Perhaps this is an exception?
>> 
>> How about wrapping the function into another function that takes only one 
>> argument? A concise way is to do that with functools.partial():
>> 
>> def f(value, queue): ...
>> 
>> pool.imap(partial(f, queue=...), values)
> 
> That looks like exactly what I was looking for. I’ll give it a shot. Thanks!

So as it turns out, this doesn’t work after all. I get an error stating that 
“Queue objects should only be shared between processes through inheritance”. 
Still a good technique to know though!

---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

> 
> ---
> Israel Brewster
> Software Engineer
> Alaska Volcano Observatory 
> Geophysical Institute - UAF 
> 2156 Koyukuk Drive 
> Fairbanks AK 99775-7320
> Work: 907-474-5172
> cell:  907-328-9145
> 
>> 
>> 
>> 
>>> 
>>> ---
>>> Israel Brewster
>>> Software Engineer
>>> Alaska Volcano Observatory
>>> Geophysical Institute - UAF
>>> 2156 Koyukuk Drive
>>> Fairbanks AK 99775-7320
>>> Work: 907-474-5172
>>> cell:  907-328-9145
>>> 
>> 
>> 
>> -- 
>> https://mail.python.org/mailman/listinfo/python-list 
>> 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35923] Update the BuiltinImporter in importlib to use loader._ORIGIN instead of a hardcoded value

2019-09-04 Thread Ned Deily


Change by Ned Deily :


--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

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



Re: How to only read words within brackets/ parentheses (in .txt file) using Python

2019-09-04 Thread Peter Otten
A S wrote:

> I understand that reading lines in .txt files would look something like
> this in Python:
> 
> 
> with open('filename','r') as fd:
>lines = fd.readlines()
> 
> 
> However, how do I run my code to only read the words in my .txt files that
> are within each balanced parenthesis?
> 
> I am not sure how to go about it, let's say my .txt file contents lines
> like this:
> 
> k;
> 
> select xx("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
> quit;



> The main idea is to read only these portions of the .txt file (i.e. Those
> within parentheses):
> 
>  ("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
> quit;

But jdfjh... is not within parens...
and what about quoted parens "("? Do they count?

You probably need a tokenizer for the SQL dialect used in your "text" file.
But first: can you give a non-technical description of what problem you are 
trying to solve instead of how you want to solve it?

Perhaps someone here knows of a better approach than counting parens.

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


[issue36226] multipart/related header causes false positive StartBoundaryNotFoundDefect and MultipartInvariantViolationDefect

2019-09-04 Thread Ned Deily


Change by Ned Deily :


--
nosy: +barry, maxking, r.david.murray

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Ned Deily


Change by Ned Deily :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



Re: How do I give a decorator acces to the class of a decorated function

2019-09-04 Thread Peter Otten
Antoon Pardon wrote:

> What I am trying to do is the following.
> 
> class MyClass (...) :
> @register
> def MyFunction(...)
> ...
> 
> What I would want is for the register decorator to somehow create/mutate
> class variable(s) of MyClass.
> 
> Is that possible or do I have to rethink my approach?

If you are willing to delegate the actual work to the metaclass call: 

def register(f):
f.registered = True
return f

def registered(name, bases, namespace):
namespace["my_cool_functions"] = [
n for n, v in namespace.items()
if getattr(v, "registered", False)
]
return type(name, bases, namespace)

class MyClass(metaclass=registered) :
@register
def foo(self):
pass
@register
def bar(self):
pass
def other(self):
pass

print(MyClass.my_cool_functions)


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


[issue37970] urllib.parse docstrings incomplete

2019-09-04 Thread sushma


sushma  added the comment:

I guess what I'm wondering is this: 

urlsplit(url, scheme='', allow_fragments=True)
Parse a URL into 5 components:
:///?#
Return a 5-tuple: (scheme, netloc, path, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes.
(END)

We don't have details regarding anything, i.e scheme, netloc, path or query or 
fragments. So I was curious about why we would have more documentation around 
netloc and scheme and nothing about path and query

Should we be adding information for all(scheme, netloc, path, query, fragment) 
of them, including extra attributes of the returned SplitResult? 

p.s - newbie trying to contribute here

--

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Ana,

The error in "piperroroutput.txt" points to the issue Mark mentioned in 
msg351131: the current release of Numpy is not compatible with Python 3.8, but 
the tip of the tree on GitHub is.

I can install Numpy from the repository:

$ python --version
Python 3.8.0b4

$ pip install git+https://github.com/numpy/numpy.git
Collecting git+https://github.com/numpy/numpy.git
  Cloning https://github.com/numpy/numpy.git to 
/private/var/folders/dy/5fl45b9s61x84g7k_18618vcgn/T/pip-req-build-b3_tnmd0
  Running command git clone -q https://github.com/numpy/numpy.git 
/private/var/folders/dy/5fl45b9s61x84g7k_18618vcgn/T/pip-req-build-b3_tnmd0
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517) ... done
  Created wheel for numpy: 
filename=numpy-1.18.0.dev0+3883be3-cp38-cp38-macosx_10_9_x86_64.whl 
size=4534619 
sha256=005a0085f7dcca60b138b0ed01c72977fa0777e4ef1e0693a84295b663ef1178
  Stored in directory: 
/private/var/folders/dy/5fl45b9s61x84g7k_18618vcgn/T/pip-ephem-wheel-cache-f8wuhnns/wheels/08/c9/f0/5fb73d652a67220580b707eb5b66bfcccf521160a016ae6f2e
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.18.0.dev0+3883be3

I propose closing this issue as a 3th-party issue. This should resolve itself 
with the next release of Numpy.

--
resolution:  -> third party
status: open -> pending

___
Python tracker 

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



How to only read words within brackets/ parentheses (in .txt file) using Python

2019-09-04 Thread A S
I understand that reading lines in .txt files would look something like this in 
Python:


with open('filename','r') as fd:
   lines = fd.readlines()


However, how do I run my code to only read the words in my .txt files that are 
within each balanced parenthesis?

I am not sure how to go about it, let's say my .txt file contents lines like 
this:

k;

select xx("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
quit; 

/* 1.x FROM _x_Ex_x */ 
proc sql; "TRUuuuth");
hhhjhfjs as fdsjfsj:
select * from djfkjd to jfkjs
(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM _xxx_xxE
   where (xxx(xx_ix as format '-xx') gff _jfjfj.) and 
  (xxx(xx_ix as format '-xx') lec _vnv.)
);


The main idea is to read only these portions of the .txt file (i.e. Those 
within parentheses):

 ("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
quit; 

/* 1.x FROM _x_Ex_x */ 
proc sql; "TRUuuuth")

(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM _xxx_xxE
   where (xxx(xx_ix as format '-xx') gff _jfjfj.) and 
  (xxx(xx_ix as format '-xx') lec _vnv.)
)



Any help will be truly appreciated
-- 
https://mail.python.org/mailman/listinfo/python-list


How to remove a string from a txt file?

2019-09-04 Thread Spencer Du
Hi

I want to remove a string from a txt file and then print out what I have 
removed. How do I do this.

The txt file is in this format and should be kept in this format.

txt.txt:
laser,cameras,

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


Re: How do I give a decorator acces to the class of a decorated function

2019-09-04 Thread Chris Angelico
On Thu, Sep 5, 2019 at 12:23 AM Antoon Pardon  wrote:
>
> What I am trying to do is the following.
>
> class MyClass (...) :
> @register
> def MyFunction(...)
> ...
>
> What I would want is for the register decorator to somehow create/mutate
> class variable(s) of MyClass.
>
> Is that possible or do I have to rethink my approach?
>

At the time when the decorator runs, the class doesn't actually exist.
But if you're wrapping MyFunction (which appears to be a method), then
your wrapper function will receive  'self' as its first parameter, and
can access the class from that. Doesn't help at decoration time,
though.

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


Re: How do I give a decorator acces to the class of a decorated function

2019-09-04 Thread Rhodri James

On 04/09/2019 15:21, Antoon Pardon wrote:

What I am trying to do is the following.

class MyClass (...) :
 @register
 def MyFunction(...)
 ...

What I would want is for the register decorator to somehow create/mutate
class variable(s) of MyClass.

Is that possible or do I have to rethink my approach?


I can't see a way of doing that directly, but you could cheat by putting 
the "class variables" in a global dictionary?  And perhaps referencing 
that global from a class variable?  Something like:


my_class_registry = {}

class MyClass(...):
MyClassRegistry = my_class_registry

@register(my_class_registry)
def MyFunction(...):
...

Or you may be able to achieve what you want with dir() and some careful 
naming?


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue37970] urllib.parse docstrings incomplete

2019-09-04 Thread Zachary Ware


Zachary Ware  added the comment:

>I don't understand why we'd have scheme and netloc, but nothing for path and 
>query.

I'm not sure what you mean here; can you please clarify?

> What are you suggesting we add for scheme/allow_fragements?

Just a brief description of what effect the arguments actually have on the 
returned result.

--

___
Python tracker 

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



How do I give a decorator acces to the class of a decorated function

2019-09-04 Thread Antoon Pardon
What I am trying to do is the following.

class MyClass (...) :
@register
def MyFunction(...)
...

What I would want is for the register decorator to somehow create/mutate
class variable(s) of MyClass.

Is that possible or do I have to rethink my approach?

-- 
Antoon Pardon.

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


[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Ana

Ana  added the comment:

Thx for the link. Btw, I have tried: pip install 
git+https://github.com/numpy/numpy.git https://github.com/numpy/numpy.git> 
That doesn’t work for me. The only way I can install somewhat is downloading 
the package, building and installing it.

> On 4 Sep 2019, at 17:11, Mark Dickinson  wrote:
> 
> 
> Mark Dickinson  added the comment:
> 
> I forgot to include the NumPy issue link: 
> https://github.com/numpy/numpy/issues/14403 (and other similar issues).
> 
> The pip error output you posted looks like the same issue to me.
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Ana


Ana  added the comment:

At the end of each error log, there is a message stating different python 
versions (up to 3.7) and AIX. However, there is no python3.8 + AIX, and there 
is no corresponding dependency:

ERROR: Command errored out with exit status 2:
   command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip
 install --ignore-installed --no-user --prefix 
/private/tmp/pip-build-env-4mykinsd/overlay --no-warn-script-location 
--no-binary :none: --only-binary :none: -i https://pypi.org/simple 
 -- wheel setuptools 'Cython>=0.29.2' 'numpy==1.13.3; 
python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 
'numpy==1.13.3; python_version=='"'"'3.6'"'"' and 
platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version>='"'"'3.7'"'"' 
and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; 
python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 
'numpy==1.16.0; python_version=='"'"'3.6'"'"' and 
platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"' 
and platform_system=='"'"'AIX'"'"''
   cwd: None

> On 4 Sep 2019, at 17:09, Mark Dickinson  wrote:
> 
> pip install git+https://github.com/numpy/numpy.git 
> https://github.com/numpy/numpy.git%60>

--

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Mark Dickinson


Mark Dickinson  added the comment:

I forgot to include the NumPy issue link: 
https://github.com/numpy/numpy/issues/14403 (and other similar issues).

The pip error output you posted looks like the same issue to me.

--

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Mark Dickinson


Mark Dickinson  added the comment:

There are known Cython-related issues with the latest NumPy *release* and 
Python 3.8, due to a signature change in PyCode_New. But those issues are 
already fixed in NumPy master. `pip install numpy` fails for me in a Python 
3.8b4 venv, but `pip install git+https://github.com/numpy/numpy.git` works.

But none of this indicates a bug in core Python, as far as I know.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Ana


Ana  added the comment:

That's huge, so I am attaching it in a separate file

--
Added file: https://bugs.python.org/file48591/piperroroutput.txt

___
Python tracker 

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



[issue38027] Can't use Numpy, SciPy, pandas in Python3.8.0b4 without conda

2019-09-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Thanks for the update.

What's the error message you get when using pip to install?

--

___
Python tracker 

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



[issue36030] add internal API function to create tuple without items array initialization

2019-09-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 60bd1f88f21073965a444c8b39c4202d015da5d6 by Victor Stinner 
(Zackery Spytz) in branch 'master':
bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)
https://github.com/python/cpython/commit/60bd1f88f21073965a444c8b39c4202d015da5d6


--

___
Python tracker 

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



[issue37966] is_normalized is much slower at "no" than the standard's algorithm

2019-09-04 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Greg Price for this nice optimization!

--

___
Python tracker 

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



[issue37891] Exceptions tutorial page does not mention raise from

2019-09-04 Thread Srinivas Nyayapati


Srinivas Nyayapati  added the comment:

Here is my first pass at this. I propose the following sentence be added at the 
end section 8.4:

If you need to track related exceptions (exceptions during exception handling), 
you should use exception chaining. You can chain exceptions by using the 
``from`` clause. Just raise a new exception class or instance from an existing 
exception. The existing exception will be set as 
the cause for the new exception.

--

___
Python tracker 

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



  1   2   >