[issue14364] Argparse incorrectly handles '--' as argument to option

2019-09-05 Thread hai shi


Change by hai shi :


--
nosy: +rhettinger
type:  -> behavior

___
Python tracker 

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



[issue14364] Argparse incorrectly handles '--' as argument to option

2019-09-05 Thread hai shi


Change by hai shi :


--
pull_requests: +15369
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/15714

___
Python tracker 

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



[issue14364] Argparse incorrectly handles '--' as argument to option

2019-09-05 Thread hai shi


hai shi  added the comment:

some test cases which paul provided looks doesn't keep compatible.

In TestDoubleDashRemoval:
# output in my env is Namespace(cmd='cmd', foo=None, rest=['--', '--foo'])
('-- cmd -- -- --foo', NS(cmd='cmd', foo=None, rest=['--', '--', '--foo']))

# output in my env is Namespace(cmd='--', foo='1', rest=['1', '2'])
('-f1 -- -- 1 -- 2', NS(cmd='--', foo='1', rest=['1', '--', '2']))

# output in my env is Namespace(cmd='--foo', foo=None, rest=['--bar', '2'])
('-- --foo -- --bar 2', NS(cmd='--foo', foo=None, rest=['--', '--bar', '2']))

# output in my env is Namespace(cmd='cmd', foo=None, rest=['--foo', '-f2'])
('cmd -- --foo -- -f2', NS(cmd='cmd', foo=None, rest=['--foo', '--', '-f2']))


In TestDoubleDashRemoval1:
# output in my env is Namespace(cmd='cmd', foo='1', rest=['-f2', '3'])
('-f1 -- cmd -- -f2 3', NS(cmd='cmd', foo='1', rest=['--', '-f2', '3']))

my python's version is: 2.7.5, 3.6.8

--
nosy: +shihai1991

___
Python tracker 

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



[issue38043] small cleanups in Unicode normalization code

2019-09-05 Thread Greg Price


Change by Greg Price :


--
pull_requests: +15368
pull_request: https://github.com/python/cpython/pull/15558

___
Python tracker 

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



[issue38043] small cleanups in Unicode normalization code

2019-09-05 Thread Greg Price


Change by Greg Price :


--
pull_requests: +15367
pull_request: https://github.com/python/cpython/pull/15712

___
Python tracker 

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



[issue38043] small cleanups in Unicode normalization code

2019-09-05 Thread Greg Price


Change by Greg Price :


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

___
Python tracker 

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



Re: Renaming an import

2019-09-05 Thread dieter
Rob Gaddi  writes:
> I'm trying to figure out how to rename an import globally for an
> entire package. Something like:
>
> pkg/__init__.py:
> import graphing_module_b as graph
>
> pkg/foobar.py:
> from .graph import plot, axis
>
> The point being that, if at some point I decide to change from
> graphing_module_b to graphing_module_a, that decision is made at a
> single central point in my package rather than scattered through 30
> different import statements in a dozen files.
>
> Any ideas?

You might have a look at `zope.deferredimport`.

Its primary task is to allow graceful handling of a change in package/module
structure: the Zope ecosystem consists of a huge number of independent
packages which should get time to adapt to such changes.
`zope.deferredimport` allows to define proxy modules as placeholders
for the original modules which relay imports to the new locations.
In addition, it generates warnings of the form "please import from ..."
to inform about the new structure.

That said: if you change the module structure, then I would recommend
that you change your own code accordingly and do not rely on
advanced features to keep the old names/locations: this makes understanding
of the code significantly more difficult.

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


[issue38043] small cleanups in Unicode normalization code

2019-09-05 Thread Greg Price


New submission from Greg Price :

Benjamin noticed in reviewing GH-15558 (for #37966) several points where the 
existing code around Unicode normalization can be improved:

* on the `QuickcheckResult` enum:
  > Maybe `makeunicodedata.py` should output this enum (with better name 
namespacing)

* > merging `test_normalization` into this file [i.e. `test_unicodedata.py`] 
for clarity

* > These "boolean int" parameters could be actual `bool`s. [sc. the `nfc` and 
`k` parameters to `is_normalized_quickcheck`]

None of these are super hard, so good to knock them out while we're thinking of 
them.

--
components: Unicode
messages: 351229
nosy: Greg Price, benjamin.peterson, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: small cleanups in Unicode normalization code
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



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

2019-09-05 Thread Ned Deily


Change by Ned Deily :


--
nosy:  -ned.deily
stage: resolved -> needs patch
versions: +Python 3.9 -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



[issue38015] inline function generates slightly inefficient machine code

2019-09-05 Thread Ma Lin


Ma Lin  added the comment:

Revert commit 5e63ab0 or use PR 15710, both are fine.

--

___
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-05 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution: not a bug -> 
status: closed -> open

___
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-05 Thread Ned Deily


Ned Deily  added the comment:

> 2to3 should be able to parse valid Python 3 code.

OK, then should the original behavior here be treated as a bug and fixed?  If 
so, this issue should be re-opened.

--

___
Python tracker 

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



[issue38015] inline function generates slightly inefficient machine code

2019-09-05 Thread Ma Lin


Change by Ma Lin :


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

___
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-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

2to3 should be able to parse valid Python 3 code.

--

___
Python tracker 

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



[issue38041] IDLE Shell: Refine restart line

2019-09-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
stage: patch review -> commit review
title: Refine IDLE Shell restart line -> IDLE Shell: Refine restart line

___
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-05 Thread Vinay Sharma


Vinay Sharma  added the comment:

Let's say I have two processes which are accessing a shared resource (let's say 
shared memory). Now, these two processes will need some kind of synchronisation 
mechanism, to be able to access the resource properly, and avoid race condition.

Currently, shared semaphores can be shared with child processes, but there is 
no way of accessing a named shared semaphore by two separate processes.

Although, the semaphore created by default is a named semaphore, and has the 
potential to be accessed by multiple processes, but because of the flags, it 
can't be opened by any other process.

This is a feature request, and not a bug, therefore I have selected type as 
enhancement.

--

___
Python tracker 

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



[issue38041] Refine IDLE Shell restart line

2019-09-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: IDLE Shell: Redesign minimum restart line -> Refine IDLE Shell restart 
line

___
Python tracker 

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



[issue38041] IDLE Shell: Redesign minimum restart line

2019-09-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



Re: Renaming an import

2019-09-05 Thread Cameron Simpson

On 05Sep2019 20:31, Michael Speer  wrote:

pkg/graph.py:
from graphing_module_b import plot, axis

pkg/foobar.py:
from .graph import plot, axis

Would it be sufficient to use a file for indirection?


Or without a stub file and only slightly less conveniently:

 pkg/__init__.py
   import graphing_module_b as graph

 pkg/foobar.py
   from . import graph
   plot = graph.plot
   axis = graph.axis

Alternatively:

 pkg/__init__.py
   import graphing_module_b as graph
   plot = graph.plot
   axis = graph.axis

 pkg/foobar.py
   from . import graph, plot, axis

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


[issue38034] Typo on logging.handlers.QueueListener documentation

2019-09-05 Thread Roundup Robot


Change by Roundup Robot :


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

___
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-05 Thread Ned Deily


Ned Deily  added the comment:

Benjamin, can you answer Justin's question above?

--
nosy: +benjamin.peterson

___
Python tracker 

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



Re: Renaming an import

2019-09-05 Thread Michael Speer
pkg/graph.py:
 from graphing_module_b import plot, axis

pkg/foobar.py:
 from .graph import plot, axis

Would it be sufficient to use a file for indirection?


On Thu, Sep 5, 2019 at 7:11 PM Rob Gaddi 
wrote:

> I'm trying to figure out how to rename an import globally for an entire
> package.
>   Something like:
>
> pkg/__init__.py:
>  import graphing_module_b as graph
>
> pkg/foobar.py:
>  from .graph import plot, axis
>
> The point being that, if at some point I decide to change from
> graphing_module_b
> to graphing_module_a, that decision is made at a single central point in
> my
> package rather than scattered through 30 different import statements in a
> dozen
> files.
>
> Any ideas?
>
> --
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order.  See above to fix.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38039] Segfault when pickling dictionary with large pandas dataframes

2019-09-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

Can you provide the code that caused the segfault?

--
nosy: +eric.smith

___
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-05 Thread Sayth Renshaw
That is actually consistent with Excel row, column. Can see why it works that 
way then.

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


Renaming an import

2019-09-05 Thread Rob Gaddi
I'm trying to figure out how to rename an import globally for an entire package. 
 Something like:


pkg/__init__.py:
import graphing_module_b as graph

pkg/foobar.py:
from .graph import plot, axis

The point being that, if at some point I decide to change from graphing_module_b 
to graphing_module_a, that decision is made at a single central point in my 
package rather than scattered through 30 different import statements in a dozen 
files.


Any ideas?

--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
Piet van Oostrum  writes:

> That would select ROWS 0,1,5,6,7, not columns.
> To select columns 0,1,5,6,7, use two-dimensional indexes
>
> df1 = df.iloc[:, [0,1,5,6,7]]
>
> : selects all rows.

And that also solves your original problem.

This statement:

df1['Difference'] = df1.loc['Current Team'].str.lower().str.strip() == 
df1.loc['New Team'].str.lower().str.strip()

should not use .loc, because then you are selecting rows, not columns, but:

df1['Difference'] = df1['Current Team'].str.lower().str.strip() == df1['New 
Team'].str.lower().str.strip()
-- 
Piet van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
Sayth Renshaw  writes:

> 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 Name FTE Agent ID Current Leader New Leader Current Team New
> Team Current Site New Site Unnamed: 10 Unnamed: 11 Unnamed: 12
>
> How do I misunderstand iloc?
>
That would select ROWS 0,1,5,6,7, not columns.
To select columns 0,1,5,6,7, use two-dimensional indexes

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

: selects all rows.
-- 
Piet van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: Installation Errors

2019-09-05 Thread venu gopal reddy
Hi Python Support Team,

I have subscribed now and re-sending my query. Please suggest.

I have an Issue installing python 3.7 on my work computer. It says core.msi
package not found during installation. Can you please help me with steps to
resolve this issue?

Thank you,
Venu
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38042] Crash on double list(lxml.etree.iterparse(f))

2019-09-05 Thread Alexander Kurakin


Change by Alexander Kurakin :


--
title: Crash on double list(lxml.etree.iterparse(f)) Edit -> Crash on double 
list(lxml.etree.iterparse(f))

___
Python tracker 

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



[issue38042] Crash on double list(lxml.etree.iterparse(f)) Edit

2019-09-05 Thread Alexander Kurakin


New submission from Alexander Kurakin :

I have a crash in Python 3.x environments and don't have in 2.7.

===

Crashes in:

Python 3.7.4, Anaconda, Linux 64bit, lxml 4.3.3
OR
Python 3.7.4, Anaconda, Linux 64bit, lxml 4.4.1
OR
Python 3.6.5, Gentoo Linux 64bit, lxml 4.3.3

test.py:

import lxml
import lxml.etree

with open('test.xml', 'rb') as f:
list(
lxml.etree.iterparse(f)
)

# Traceback (most recent call last):
# File "test.py", line 18, in 
# lxml.etree.iterparse(f)
# File "src/lxml/iterparse.pxi", line 209, in lxml.etree.iterparse.__next__
# File "src/lxml/iterparse.pxi", line 194, in lxml.etree.iterparse.__next__
# File "src/lxml/iterparse.pxi", line 225, in 
lxml.etree.iterparse._read_more_events
# File "src/lxml/parser.pxi", line 1380, in lxml.etree._FeedParser.close
# Segmentation fault
list(
lxml.etree.iterparse(f)
)

test.xml:




(or any else)

GDB's backtrace see in attachment.

===

Doesn't crash in:

Python 2.7.15, Gentoo Linux 64bit, lxml 4.3.3

# Traceback (most recent call last):
#   File "test.py", line 19, in 
# lxml.etree.iterparse(f)
#   File "src/lxml/iterparse.pxi", line 209, in lxml.etree.iterparse.__next__
#File "/home/sasha/_lxml-bug/test.xml", line 0
lxml.etree.XMLSyntaxError: no element found

===

See also: https://bugs.launchpad.net/lxml/+bug/1833050

--
files: bt.txt
messages: 351222
nosy: kuraga
priority: normal
severity: normal
status: open
title: Crash on double list(lxml.etree.iterparse(f)) Edit
type: crash
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file48595/bt.txt

___
Python tracker 

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



[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-09-05 Thread Ryan May


Change by Ryan May :


--
nosy: +Ryan May

___
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-05 Thread Chris Angelico
On Fri, Sep 6, 2019 at 4:33 AM Serhiy Storchaka  wrote:
>
> 04.09.19 17:21, 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?
> >
>
> You can make register() returning a descriptor with the __set_name__()
> method.

Was not aware of that. Cool! For those not familiar with it:

https://docs.python.org/3/reference/datamodel.html#object.__set_name__

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


[issue38040] Typo: "Writeable" Should be "Writable" in IO Library Documentation

2019-09-05 Thread Sean Happenny


Sean Happenny  added the comment:

It is a minor issue and I understand that there are many, much more
important fixes and features the whole Python dev team is working on.

But reading the documentation for these classes indicates that these
classes may have a "writeable" member. If, as an example, the user then
needs to examine the implementation of these classes and searches for
"writeable" in the CPython, they'll find instances in comments, but not in
the code. This may cause them to miss the real spelling of the method
"writable()".

Also, another justification is that the documentation should be correct and
currently it is not. This fix should be a very simple find-and-replace, but
does touch multiple files (probably more than those I referenced) and I
understand how that is.

On Thu, Sep 5, 2019, 11:44 SilentGhost  wrote:

>
> SilentGhost  added the comment:
>
> There are more cases of using this spelling in the code base, but I
> personally don't see how any confusion can arise and why this "fix" is
> needed.
>
> --
> nosy: +SilentGhost
>
> ___
> Python tracker 
> 
> ___
>

--

___
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-05 Thread Justin Arthur


Justin Arthur  added the comment:

Ned, can you confirm that 2to3 is not intended for cumulative/incremental runs 
over the same codebase?

If it's not intended to be run on previously ported code, this will just need 
to be fixed on the lib2to3 downstream projects like awpa and Black that are 
encountering this issue.

--

___
Python tracker 

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



[issue14689] make PYTHONWARNINGS variable work in libpython

2019-09-05 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@petere do you want to open a PR with your patch here: 
https://github.com/python/cpython/pulls

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue38041] IDLE Shell: Redesign minimum restart line

2019-09-05 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Currently, Shell prints restart lines as 
=...= RESTART filename =...=
where filename is 'Shell' or the full pathname.  The code is 

tag = 'RESTART: ' + (filename if filename else 'Shell')
halfbar = ((int(console.width) -len(tag) - 4) // 2) * '='
console.write("\n{0} {1} {0}".format(halfbar, tag))

The initial '\n' is needed because typically the cursor is sitting at a prompt. 
 The -4 is from #21192 when I added 'Shell' or filename.  It is -2 for the 
spaces plus a couple of extra spaces that were there before.  I believe -2 is 
sufficient but will have to test to be sure.

The number of '='s is the currently the same on both ends.  (Because this is 
easiest.)  It does not have to be, and would sometimes not be if we exactly 
filled the console width.  I think we should because it would show the actual 
non-printable margin and would allow 

The minimum number of '='s is 0.  The problem revealed in
https://stackoverflow.com/questions/57795679/why-is-this-code-printing-an-empty-line-when-run-under-idle
is that if console.width is exactly 10 + len(filename), the remaining trailing 
space wraps to the next line, making it look like a spurious print(' ') had 
occurred.

Possible solutions:

0. Do nothing.  I rejected this by opening this issue.  The SO beginner was 
apparently genuinely confused and might not be the only such person.  With no 
spec for the restart line, this is not an implementation bug but is a design 
glitch.  As I hinted above, some current details are the result of adding 
filenames with minimal change.

1. Delete the ' 's surrounding the tag when there are no '='s.  This looks 
strange because the '='s visually mark a restart line as much as 'RESTART'.

2. Print a minimum of 1 '=' on each end (by adding them to the format). This 
could result in a wrap of exactly ' =' or '=', either of which are bad.  If 
there is any wrap, it should be the filename, so the user can recognize it as 
such.

3. A hybrid solution with a minimum of 1 '=' on the front and 0 on the end, 
with no space if no '='.  I intend to try this after extracting the restart 
line into a testable function and writing tests that now fail.

4. Add a horizontal scrollbar to Shell.  This not happening now, might be made 
optional, and would still require specification decisions.

--
assignee: terry.reedy
components: IDLE
messages: 351218
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE Shell: Redesign minimum restart line
type: behavior
versions: 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



[issue38040] Typo: "Writeable" Should be "Writable" in IO Library Documentation

2019-09-05 Thread SilentGhost


SilentGhost  added the comment:

There are more cases of using this spelling in the code base, but I personally 
don't see how any confusion can arise and why this "fix" is needed.

--
nosy: +SilentGhost

___
Python tracker 

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



EuroPython 2019 - Videos for Wednesday available

2019-09-05 Thread M.-A. Lemburg
We are pleased to announce the first batch of cut videos from
EuroPython 2019 in Basel, Switzerland.


 * EuroPython 2019 YouTube Channel *

http://europython.tv/


In this batch, we have included all videos for Wednesday, July 10
2019, the first conference day.

In the coming two weeks we will publish videos for the next two
conference days. In total, we will have more than 130 videos available
for you to watch.

All EuroPython videos, including the ones from previous conferences,
are available on our EuroPython YouTube Channel.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/187487578492/europython-2019-videos-for-wednesday-available

Tweet:

https://twitter.com/europython/status/1169233806764728320


Enjoy,
--
EuroPython 2019 Team
https://ep2019.europython.eu/
https://www.europython-society.org/
--
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/

Support the Python Software Foundation:
http://www.python.org/psf/donations/


EuroPython 2019 - Videos for Wednesday available

2019-09-05 Thread M.-A. Lemburg
We are pleased to announce the first batch of cut videos from
EuroPython 2019 in Basel, Switzerland.


 * EuroPython 2019 YouTube Channel *

http://europython.tv/


In this batch, we have included all videos for Wednesday, July 10
2019, the first conference day.

In the coming two weeks we will publish videos for the next two
conference days. In total, we will have more than 130 videos available
for you to watch.

All EuroPython videos, including the ones from previous conferences,
are available on our EuroPython YouTube Channel.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/187487578492/europython-2019-videos-for-wednesday-available

Tweet:

https://twitter.com/europython/status/1169233806764728320


Enjoy,
--
EuroPython 2019 Team
https://ep2019.europython.eu/
https://www.europython-society.org/

-- 
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-05 Thread Serhiy Storchaka

04.09.19 17:21, 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?



You can make register() returning a descriptor with the __set_name__() 
method. A bit of black magic:


class register:
def __init__(self, func):
self.func = func
def __get__(self, instance, owner):
return self.func.__get__(instance, owner)
def __set_name__(self, owner, name):
if not hasattr(owner, 'my_cool_functions'):
owner.my_cool_functions = []
owner.my_cool_functions.append(name)
setattr(owner, name, self.func)

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


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

2019-09-05 Thread Barry Scott



> On 5 Sep 2019, at 16:18, Random832  wrote:

Thanks for taking the time to reply.

> 
> On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote:
>> 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?
> 
> While as I mentioned in my other post I'm not sure if the CVE's analysis of 
> URL behavior is correct generally,

Agreed, would have liked to have had more details and context.

> you have missed the fact that an HTML page can provide URLs in unicode, 
> either with the page itself encoded in UTF-8, or with whatever characters 
> escaped as XML character references... not only as bytes in IDNA or 
> percent-escaped hex. The same principle applies to other formats in which 
> URLs might be interchanged as encoded unicode strings, such as JSON. The fact 
> that accessing such a URL requires converting the non-ASCII parts to IDNA 
> (for the domain part) or percent-escaped hex (for other parts) doesn't limit 
> this to user input.
> 
> https://example.com@bing.com;>like this


That gets the unicode version into the app and then the bug can be triggered.

In my case this is not a way in as the code does not parse web pages.

Barry



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

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


Re: "How to protect the python code"

2019-09-05 Thread Grant Edwards
On 2019-09-05, Michael Torrie  wrote:

> I've never understood why companies are so obsessed with preventing
> users from modifying their programs.

Because they'll change it, the result won't behave correctly, and then
the user will waste a lot of tech-support hours or ruin the company's
reputation among others who are trying to use the now-broken program?

-- 
Grant Edwards   grant.b.edwardsYow! Is this TERMINAL fun?
  at   
  gmail.com

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


[issue38040] Typo: "Writeable" Should be "Writable" in IO Library Documentation

2019-09-05 Thread Sean Happenny


New submission from Sean Happenny :

Problem: There are 4 instances of the typo "writeable" in the documentation for 
the IO library affecting, at least, versions 3.7, 3.8, 3.9, and the latest 
master of the documentation 
(https://docs.python.org/[3.7,3.8,3.9]/library/io.html and 
https://github.com/python/cpython/blob/master/Doc/library/io.rst).  This can 
cause confusion to the reader.  The instances are under the "BufferedWriter" 
section (https://docs.python.org/3/library/io.html#io.BufferedWriter) and 
"BufferedRWPair" section 
(https://docs.python.org/3.7/library/io.html#io.BufferedRWPair).

Fix: Change all instances of "writeable" to "writable" in the IO library 
documentation.

--
assignee: docs@python
components: Documentation, IO
messages: 351216
nosy: Sean Happenny, docs@python
priority: normal
severity: normal
status: open
title: Typo: "Writeable" Should be "Writable" in IO Library Documentation
type: enhancement
versions: 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



Re: "How to protect the python code"

2019-09-05 Thread Michael Torrie
On 9/5/19 2:48 AM, Saba Kauser wrote:
> I am looking for ways available to protect the python source code
> from being available to users for write/modify. Is it a good idea to
> think that python source code can be protected?
In general, no, not with an interpreted language.

Intellectual property is protected by copyright and patents. The Python
code you write is copyright by you and by few rights are granted to the
end user by default, as governed by the license you subject them to.
Copyright holds whether a person can view the source code or not.

And of course in the case of patents that means everything must be
published for all to see, so these are open by nature. (They aren't
secret to begin with.)

Most end users have very little curiosity about reading your Python
code.  In fact they don't even know or care that it is Python. Trying to
hide or obfuscate the code is pointless in my opinion, and a waste of
time and money.

I've never understood why companies are so obsessed with preventing
users from modifying their programs.  If a program doesn't quite meet
the needs of the end user, and it is possible for him to modify it to do
so, I say go for it.  As long as he doesn't distribute a a derivative
product and violate the copyright, I don't see the problem.

On one occasion I was using a proprietary Java application (compiled of
course) that had a silly thing where it would refuse to run under some
graphics conditions, such as 16-bit color over RDP.  So I decompiled the
class where the check was and changed it.  There were good reasons for
this check, but in my case it didn't matter.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-09-05 Thread Ned Deily


Ned Deily  added the comment:

"2to3 is a Python program that reads Python 2.x source code and applies a 
series of fixers to transform it into valid Python 3.x code."

The example you supply, badvar,py, is not a valid Python 2.x program.  Python 2 
identifiers cannot contain such characters.

https://docs.python.org/3/library/2to3.html
https://docs.python.org/2/reference/lexical_analysis.html#identifiers
https://docs.python.org/3/reference/lexical_analysis.html#identifiers

--
nosy: +ned.deily
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38035] shared_semaphores cannot be shared across unrelated processes

2019-09-05 Thread Ned Deily


Ned Deily  added the comment:

Please give an example of how this is a problem in using Python. You don't give 
any context here.

--
nosy: +ned.deily

___
Python tracker 

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



[issue38038] Remove urllib.parse._splittype from xmlrpc.client

2019-09-05 Thread Dong-hee Na


Change by Dong-hee Na :


--
title: Remove urllib.parse._ from xmlrpc.client -> Remove 
urllib.parse._splittype from xmlrpc.client

___
Python tracker 

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



[issue38039] Segfault when pickling dictionary with large pandas dataframes

2019-09-05 Thread Ilya Valmianski


New submission from Ilya Valmianski :

Tried pickling a dictionary with multiple pandas tables and python primitive 
types. Pandas tables are large so full object size is ~200GB but system should 
not be OOM (crashed with ~300 GB system memory available). Reproduced on two 
machines running RHEL 7.5. Tried using Python 3.6 and 3.7. Tried pickle and 
dill. All python versions were installed as environments via Anaconda. All 
segfault in pickle. Here is a dump:

Fatal Python error: Segmentation fault

Current thread 0x7f724af23740 (most recent call first):
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 496 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 805 in _batch_appends
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 781 in save_list
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 476 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 751 in save_tuple
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 476 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 634 in save_reduce
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 521 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 847 in _batch_setitems
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 821 in save_dict
  File "/apps/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 893 in 
save_module_dict
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 476 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 634 in save_reduce
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 521 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 847 in _batch_setitems
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 821 in save_dict
  File "/apps/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 893 in 
save_module_dict
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 476 in save
  File "/apps/anaconda3/lib/python3.6/pickle.py", line 409 in dump
  File "/apps/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 286 in 
dump
  File "precompute_control_patients.py", line 220 in main
  File "/apps/anaconda3/lib/python3.6/site-packages/absl/app.py", line 251 in 
_run_main
  File "/apps/anaconda3/lib/python3.6/site-packages/absl/app.py", line 300 in 
run
  File "precompute_control_patients.py", line 227 in 

--
messages: 351213
nosy: Ilya Valmianski
priority: normal
severity: normal
status: open
title: Segfault when pickling dictionary with large pandas dataframes
type: crash
versions: Python 3.6, Python 3.7

___
Python tracker 

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



RE: "How to protect the python code"

2019-09-05 Thread Saba Kauser
Thanks Chris.
Makes sense!


-Original Message-
From: Chris Angelico 
Sent: Thursday, September 5, 2019 2:34 PM
To: python-list@python.org
Subject: Re: "How to protect the python code"

On Thu, Sep 5, 2019 at 6:50 PM Saba Kauser  wrote:
>
> Hello Experts,
>
> I am looking for ways available to protect the python source code from being 
> available to users for write/modify.

Run it on a server and don't let them see the source code.

> Is it a good idea to think that python source code can be protected?

Nope. If you're going to ship Python code for people to run on their own 
systems - or, honestly, *any* code - you should assume that they can read it 
themselves. The only way is to NOT ship the code, which (in today's world) 
usually means publishing it as a web app.

ChrisA


Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ 
Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: 
https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - 
http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy


This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37064] Feature request: option to keep/add flags to pathfix.

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3f43ceff186da09978d0aff257bb18b8ac7611f7 by Victor Stinner in 
branch 'master':
bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705)
https://github.com/python/cpython/commit/3f43ceff186da09978d0aff257bb18b8ac7611f7


--

___
Python tracker 

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



[issue37878] Sub-Interpreters : Document PyThreadState_DeleteCurrent()

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Joannah.

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



[issue37878] Sub-Interpreters : Document PyThreadState_DeleteCurrent()

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2bc43cdc015eda4f1a651bb2b308a17a83c38e14 by Victor Stinner 
(Joannah Nanjekye) in branch 'master':
bpo-37878: Remove PyThreadState_DeleteCurrent() function (GH-15315)
https://github.com/python/cpython/commit/2bc43cdc015eda4f1a651bb2b308a17a83c38e14


--

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-09-05 Thread Steve Dower


Steve Dower  added the comment:

I triggered automatic backports to see how they go. Doesn't necessarily mean 
we'll merge them without looking more closely, but may as well check out what 
our automated tools suggest.

--

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-09-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15361
pull_request: https://github.com/python/cpython/pull/15707

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-09-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15360
pull_request: https://github.com/python/cpython/pull/15706

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-09-05 Thread Steve Dower


Change by Steve Dower :


--
stage: patch review -> backport needed
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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

The function is not documented nor tested.

I searched for usage of PyGen_NeedsFinalizing() in C code in GitHub:
https://github.com/search?l=C=1=PyGen_NeedsFinalizing=Code

I only found copies of the CPython code source: PyGen_NeedsFinalizing() 
definition in genobject.h.

IHMO we can safely remove the function right now. If someone complains, we can 
reintroduce it later. We just have to document clearly its removal at:
https://docs.python.org/dev/whatsnew/3.9.html#build-and-c-api-changes

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

PyGen_NeedsFinalizing() was added by:

commit 49fd7fa4431da299196d74087df4a04f99f9c46f
Author: Thomas Wouters 
Date:   Fri Apr 21 10:40:58 2006 +

Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html

Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:

test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec

This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.

It was used in this gcmodule.c function:

/* Return true if object has a finalization method.
 * CAUTION:  An instance of an old-style class has to be checked for a
 *__del__ method, and earlier versions of this used to call PyObject_HasAttr,
 * which in turn could call the class's __getattr__ hook (if any).  That
 * could invoke arbitrary Python code, mutating the object graph in arbitrary
 * ways, and that was the source of some excruciatingly subtle bugs.
 */
static int
has_finalizer(PyObject *op)
{
if (PyInstance_Check(op)) {
assert(delstr != NULL);
return _PyInstance_Lookup(op, delstr) != NULL;
}
else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE))
return op->ob_type->tp_del != NULL;
else if (PyGen_CheckExact(op))
return PyGen_NeedsFinalizing((PyGenObject *)op);
else
return 0;
}


(2) The PEP 442 implementation made PyGen_NeedsFinalizing() useless:

commit 796564c27b8f2e32b9fbc034bbdda75f9507ca43
Author: Antoine Pitrou 
Date:   Tue Jul 30 19:59:21 2013 +0200

Issue #18112: PEP 442 implementation (safe object finalization).

Replaced:

/* Return true if object has a finalization method. */
static int
has_finalizer(PyObject *op)
{
if (PyGen_CheckExact(op))
return PyGen_NeedsFinalizing((PyGenObject *)op);
else
return op->ob_type->tp_del != NULL;
}

with:

/* Return true if object has a pre-PEP 442 finalization method. */
static int
has_legacy_finalizer(PyObject *op)
{
return op->ob_type->tp_del != NULL;
}

--

The last reference to PyGen_NeedsFinalizing() can be found in ceval.c:

case TARGET(SETUP_FINALLY): {
/* NOTE: If you add any new block-setup opcodes that
   are not try/except/finally handlers, you may need
   to update the PyGen_NeedsFinalizing() function.
   */

PyFrame_BlockSetup(f, SETUP_FINALLY, INSTR_OFFSET() + oparg,
   STACK_LEVEL());
DISPATCH();
}

--
nosy: +vstinner

___
Python tracker 

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



Re: Wind Rose Plotting in Python

2019-09-05 Thread Ross Wilson
On Thu, 5 Sep 2562 at 22:00 Madhavan Bomidi  wrote:

> Hi,
>
> Can someone help me on how to make the wind rose plotting (similar to the
> figure 2 in the paper:
> https://agupubs.onlinelibrary.wiley.com/doi/epdf/10.1029/2011JD016386) in
> Python?
>
> The input file contains the data in 4 columns:
>
> [date, time, wind_speed, wind_direction]
>
> Look forward to your support and suggestions.
>

Hi Madhavan,

I can only see the first page of the paper you linked, so this might not
help.

Try looking at the "windrose" third-party library for matplotlib at
https://github.com/python-windrose/windrose .  The matplotlib page of
third-party libraries is at
https://matplotlib.org/3.1.1/thirdpartypackages/index.html#windrose .

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


[issue37064] Feature request: option to keep/add flags to pathfix.

2019-09-05 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +15359
pull_request: https://github.com/python/cpython/pull/15705

___
Python tracker 

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



[issue37064] Feature request: option to keep/add flags to pathfix.

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

The newly added test fails if Python is installed:

https://buildbot.python.org/all/#/builders/188/builds/927

==
FAIL: test_pathfix (test.test_tools.test_pathfix.TestPathfixFunctional)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py",
 line 36, in test_pathfix
self.pathfix(
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py",
 line 24, in pathfix
self.assertEqual(proc.returncode, 0, proc)
AssertionError: 2 != 0 : 
CompletedProcess(args=['/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9',
 
'/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py',
 '-i', '/usr/bin/python3', '-n', '@test_1589863_tmp'], returncode=2, 
stdout=b'', 
stderr=b"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9:
 can't open file 
'/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py':
 [Errno 2] No such file or directory\n")

==
FAIL: test_pathfix_keeping_flags 
(test.test_tools.test_pathfix.TestPathfixFunctional)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py",
 line 50, in test_pathfix_keeping_flags
self.pathfix(
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py",
 line 24, in pathfix
self.assertEqual(proc.returncode, 0, proc)
AssertionError: 2 != 0 : 
CompletedProcess(args=['/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9',
 
'/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py',
 '-i', '/usr/bin/python3', '-k', '-n', '@test_1589863_tmp'], returncode=2, 
stdout=b'', 
stderr=b"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9:
 can't open file 
'/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py':
 [Errno 2] No such file or directory\n")

--

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

My searches show references to this function in CPython cloned repositories. 
From @pitrous's views, I think it is better to deprecate it with a removal 
notice for a later release.

I have deprecated the Function instead and will be removed in the next release 
in this PR https://github.com/python/cpython/pull/15702 .

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-09-05 Thread Chip Lynch


Chip Lynch  added the comment:

I see there is a merged patch for this 
(https://github.com/python/cpython/pull/14360); is it possible to get it tagged 
for backport to 3.7?  I haven't seen the 3.7.5 tag drop yet so wanted to 
recommend it's included, it's giving us fits.  On our Windows 10 dev boxes and 
Win 2016 servers, emanuel's repro fails 3.5.4, 3.6.8, 3.7.4, and 3.8.0b4, but 
not apparently 2.7 (I think we tested 2.7.12).  Per vstinner's request, I agree 
and would like to see it get a 3.7 and 3.8 backport.

Many thanks!

--
nosy: +Chip Lynch

___
Python tracker 

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



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

2019-09-05 Thread Random832
On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote:
> 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?

While as I mentioned in my other post I'm not sure if the CVE's analysis of URL 
behavior is correct generally, you have missed the fact that an HTML page can 
provide URLs in unicode, either with the page itself encoded in UTF-8, or with 
whatever characters escaped as XML character references... not only as bytes in 
IDNA or percent-escaped hex. The same principle applies to other formats in 
which URLs might be interchanged as encoded unicode strings, such as JSON. The 
fact that accessing such a URL requires converting the non-ASCII parts to IDNA 
(for the domain part) or percent-escaped hex (for other parts) doesn't limit 
this to user input.

https://example.com@bing.com;>like this
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-09-05 Thread Random832
On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote:
> I have been looking into CVE-2019-9636 and I'm not sure that
> python code that works in bytes is vulnerable to this.

I'm not convinced that the CVE (or, at least, the description in the bug 
report... it's also unclear to me whether this is an accurate example of the 
CVE) is valid at all. That is, I don't think its suggestion that browsers 
generally use compatibility normalization in decomposing URLs is correct.

I tried the given address "https://example.com\uf...@bing.com; (with actual 
\uff03 character) in Firefox, Chrome, and Edge, and they all accessed bing.com.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36797] Cull more oudated distutils information

2019-09-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15358
pull_request: https://github.com/python/cpython/pull/15704

___
Python tracker 

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



[issue36797] Cull more oudated distutils information

2019-09-05 Thread miss-islington

miss-islington  added the comment:


New changeset 2c2b561967c1916855399f809e30ae0ba7e09ae2 by Miss Islington (bot) 
(Miro Hrončok) in branch 'master':
bpo-36797: Fix a dead link in  Doc/distutils/apiref (GH-15700)
https://github.com/python/cpython/commit/2c2b561967c1916855399f809e30ae0ba7e09ae2


--

___
Python tracker 

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



Wind Rose Plotting in Python

2019-09-05 Thread Madhavan Bomidi
Hi,

Can someone help me on how to make the wind rose plotting (similar to the 
figure 2 in the paper: 
https://agupubs.onlinelibrary.wiley.com/doi/epdf/10.1029/2011JD016386) in 
Python?

The input file contains the data in 4 columns: 

[date, time, wind_speed, wind_direction]

Look forward to your support and suggestions.



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


[issue37064] Feature request: option to keep/add flags to pathfix.

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 50254ac4c179cb412e90682098c97db786143929 by Victor Stinner 
(PatrikKopkan) in branch 'master':
bpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548)
https://github.com/python/cpython/commit/50254ac4c179cb412e90682098c97db786143929


--
nosy: +vstinner

___
Python tracker 

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



[issue37926] regression: PySys_SetArgvEx(0, NULL, 0): SystemError: Python-3.8.0b3/Objects/unicodeobject.c:2089: bad argument to internal function

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

FYI this bug was found in paraview in Fedora Rawhide: 
https://bugzilla.redhat.com/show_bug.cgi?id=1743896

--

___
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-05 Thread Peter Otten
Antoon Pardon wrote:

> On 5/09/19 15:30, Peter Otten wrote:

>> Can you provide some context?
> 
> Sure I am researching the possibility of writing an easy to use
> lexing/parsing tool. The idea is to write your lexer/parser as
> follows:
> 
> class Calculator(metaclass = ...):
> def __init__(self):
> self.names = set()
> self.table = {}
> 
> @token(r'\d+')
> def NUMBER(self, st):
> return int(st)
> 
> @token(r'\w+')
> def VAR(self, st):
> self.names.add(st)
> return st
> 
> @production(r"VAR '=' NUMBER")
> def assign(self, prd):
> name = prd[0]
> val = prd[1]
> if name in self.names:
> self.table[name] = value
> else:
> raise CalcError("variable (%s) not available" % name)
> 
> calc = Calculator()
> calc("a = 7")
> 
> So the token en production decorators register a regex/prodcution with
> a specific method to be called in specific circumstances when parsing
> a string.
> 
> So I need the lexing and parsing algorithms available to this class,
> either by adding methods to the class or by making a subclass of the
> class where they are implemented.

Ok, that looks like a nice interface to me, and I don't expect the metaclass 
dance to make it harder to implement than necessary ;)


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


[issue38038] Remove urllib.parse._ from xmlrpc.client

2019-09-05 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue38038] Remove urllib.parse._ from xmlrpc.client

2019-09-05 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue38038] Remove urllib.parse._ from xmlrpc.client

2019-09-05 Thread Dong-hee Na


Change by Dong-hee Na :


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



[issue38038] Remove urllib.parse._ from xmlrpc.client

2019-09-05 Thread Dong-hee Na


New submission from Dong-hee Na :

This issue is the same as bpo-22347.
Let's remove the deprecated urllib.parse._splituser and urllib.parse._splittype 
from xmlrpc.client

--
components: Library (Lib)
messages: 351199
nosy: corona10, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Remove urllib.parse._ from xmlrpc.client
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



[issue38037] Assertion failed: object has negative ref count

2019-09-05 Thread Ma Lin


Ma Lin  added the comment:

I did a Git bisect, this is the first bad commit:
https://github.com/python/cpython/commit/9541bd321a94f13dc41163a5d7a1a847816fac84

nosy involved mates.

--
nosy: +berker.peksag, nanjekyejoannah

___
Python tracker 

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



[issue15088] PyGen_NeedsFinalizing is public, but undocumented

2019-09-05 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
pull_requests: +15356
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15702

___
Python tracker 

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



[issue38037] Assertion failed: object has negative ref count

2019-09-05 Thread Ma Lin


Change by Ma Lin :


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

___
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-05 Thread Antoon Pardon
On 5/09/19 15:30, Peter Otten wrote:
>> 2) Is it possible to make MyClass automatically a subclass of an other
>> class
>>through the metaclass?
>>
> While you can modify `bases` before passing it on to `type` this starts to 
> get a bit messy. Maybe you need a real metaclass which unlike the registered 
> function above is shared by the subclasses...
>
> import random
>
> def register(f):
> f.registered = True
> return f
>
> class Foo: pass
> class Bar: pass
>
> class RegisterMeta(type):
> def __new__(cls, name, bases, namespace):
> namespace["my_cool_functions"] = [
> n for n, v in namespace.items()
> if getattr(v, "registered", False)
> ]
> return type.__new__(
> cls, name,
> bases + (random.choice([Foo, Bar]),),
> namespace
> )
>
> class RegisterBase(metaclass=RegisterMeta):
> def __getitem__(self, i):
> return self.my_cool_functions[i]
>
> class MyClass(RegisterBase):
> @register
> def foo(self):
> pass
> @register
> def bar(self):
> pass
> def other(self):
> pass
>
> print(MyClass.my_cool_functions)
> print(MyClass()[0])
> print(MyClass.my_cool_functions is RegisterBase.my_cool_functions)  # False
> print(MyClass.__bases__, RegisterBase.__bases__)
>
>
> ...or something else entirely. Can you provide some context?

Sure I am researching the possibility of writing an easy to use
lexing/parsing tool. The idea is to write your lexer/parser as
follows:

class Calculator(metaclass = ...):
def __init__(self):
self.names = set()
self.table = {}

@token(r'\d+')
def NUMBER(self, st):
return int(st)

@token(r'\w+')
def VAR(self, st):
self.names.add(st)
return st

@production(r"VAR '=' NUMBER")
def assign(self, prd):
name = prd[0]
val = prd[1]
if name in self.names:
self.table[name] = value
else:
raise CalcError("variable (%s) not available" % name)

calc = Calculator()
calc("a = 7")

So the token en production decorators register a regex/prodcution with
a specific method to be called in specific circumstances when parsing
a string.

So I need the lexing and parsing algorithms available to this class,
either by adding methods to the class or by making a subclass of the
class where they are implemented.

-- 
Antoon Pardon.

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


[issue36409] plistlib old API should be removed

2019-09-05 Thread Jon Janzen


Change by Jon Janzen :


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



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

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

> On 4/09/19 17:46, Peter Otten wrote:
>> 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)
> 
> I have been playing with this idea and it looks promising. I was wondering
> about two points.
> 
> 1) I guess I can add extra methods to my class through the metaclass by
>having something like the following in the registered function:
> 
> def registered(name, bases, namespace):
> namespace["my_cool_functions"] = [
> n for n, v in namespace.items()
> if getattr(v, "registered", False)
> ]
> namespace["__getitem__"] = lambda self, index:
> self.my_cool_functions[index]

Methods are just functions as class attributes, so yes. Problems may arise 
with __private attributes and super().

> 
> 2) Is it possible to make MyClass automatically a subclass of an other
> class
>through the metaclass?
> 

While you can modify `bases` before passing it on to `type` this starts to 
get a bit messy. Maybe you need a real metaclass which unlike the registered 
function above is shared by the subclasses...

import random

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

class Foo: pass
class Bar: pass

class RegisterMeta(type):
def __new__(cls, name, bases, namespace):
namespace["my_cool_functions"] = [
n for n, v in namespace.items()
if getattr(v, "registered", False)
]
return type.__new__(
cls, name,
bases + (random.choice([Foo, Bar]),),
namespace
)

class RegisterBase(metaclass=RegisterMeta):
def __getitem__(self, i):
return self.my_cool_functions[i]

class MyClass(RegisterBase):
@register
def foo(self):
pass
@register
def bar(self):
pass
def other(self):
pass

print(MyClass.my_cool_functions)
print(MyClass()[0])
print(MyClass.my_cool_functions is RegisterBase.my_cool_functions)  # False
print(MyClass.__bases__, RegisterBase.__bases__)


...or something else entirely. Can you provide some context?

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


[issue24416] Have date.isocalendar() return a structseq instance

2019-09-05 Thread Dong-hee Na


Dong-hee Na  added the comment:

@vstinner

Here is the new benchmark with you suggested.
It seems to affect performance.

== Baseline == 
Mean +- std dev: 134 ns +- 2 ns

== PR 15633 ==
Mean +- std dev: 174 ns +- 5 ns

--

___
Python tracker 

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



[issue36797] Cull more oudated distutils information

2019-09-05 Thread Miro Hrončok

Change by Miro Hrončok :


--
pull_requests: +15354
pull_request: https://github.com/python/cpython/pull/15700

___
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-05 Thread Dong-hee Na


Change by Dong-hee Na :


--
resolution: fixed -> duplicate
superseder:  -> mimetypes.guess_type("//example.com") misinterprets host name 
as file name

___
Python tracker 

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



web design companies in vizag

2019-09-05 Thread mahiswitharosie
We are Best Web Designing Companies in vizag if your are looking for web 
designing services in visakhapatnam we are the Best website designers in vizag.
web design companies in vizag
--
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue24416] Have date.isocalendar() return a structseq instance

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

"""
./python.exe -m timeit -r11 -s 'import datetime' -s 'a = 
datetime.datetime.now().isocalendar()'
5000 loops, best of 11: 8.72 nsec per loop

Let me know if the benchmark code is not appropriate
"""

Hum wait, this benchmark measures the performance of the pass opcode... That's 
why it's so fast :-) -s 'a = datetime.datetime.now().isocalendar()' is run 
exactly once for the whole benchmark, not at each benchmark iteration...

I suggest you this microbenchmark instead:

./python.exe -m pyperf timeit -s 'import datetime; dt = 
datetime.datetime.now()' 'dt.isocalendar()'

For example, on my Fedora 30 with Python 3.7.4, I get:

Mean +- std dev: 108 ns +- 4 ns

--

___
Python tracker 

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



[issue38037] Assertion failed: object has negative ref count

2019-09-05 Thread Ma Lin


New submission from Ma Lin :

Adding these two lines to /Objects/longobject.c will disable the "preallocated 
small integer pool":

#define NSMALLPOSINTS  0
#define NSMALLNEGINTS  0

Then run this reproduce code (attached):

from enum import IntEnum
import _signal

class Handlers(IntEnum):
A = _signal.SIG_DFL
B = _signal.SIG_IGN

When the interpreter exits, will get this error:

d:\dev\cpython\PCbuild\win32>python_d.exe d:\a.py
d:\dev\cpython\include\object.h:541: _Py_NegativeRefcount: Assertion 
failed: object has negative ref count

Fatal Python error: _PyObject_AssertFailed

Current thread 0x200c (most recent call first):

3.8 and 3.9 branches are affected.
I'm sorry, this issue is beyond my ability.

--
files: reproduce.py
messages: 351196
nosy: Ma Lin
priority: normal
severity: normal
status: open
title: Assertion failed: object has negative ref count
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48594/reproduce.py

___
Python tracker 

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



[issue18049] Re-enable threading test on macOS

2019-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

> Ronald, is it feasible that the changes made in 
> https://github.com/python/cpython/pull/14748/files to THREAD_STACK_SIZE in 
> Python/thread_pthread.h could be causing intermittent failures for the Azure 
> macOS PR tests?

See also bpo-37245 ("Azure Pipeline 3.8 CI: multiple tests hung and timed out 
on macOS 10.13").

--

___
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-05 Thread Kyle Stanley


Kyle Stanley  added the comment:

It looks like the Azure macOS tests timed out again in the recently opened 
PR-15688. Specifically, for test_multiprocessing_spawn and test_functools (both 
of which also timed out in PR-15651, which Victor mentioned earlier):

0:26:41 load avg: 2.89 [418/419/1] test_multiprocessing_spawn crashed (Exit 
code 1) -- running: test_functools (14 min 38 sec)
Timeout (0:20:00)!

0:32:03 load avg: 3.17 [419/419/2] test_functools crashed (Exit code 1)
Timeout (0:20:00)!

Build logs: 
https://dev.azure.com/Python/cpython/_build/results?buildId=49868=logs=18d1a34d-6940-5fc1-f55b-405e2fba32b1

As far as I can tell, PR-15688 should have had no direct influence on 
test_multiprocessing_spawn or test_functools.

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

> Yeah, I agree that increasing the timeout shouldn't be the answer here. 

Since this seems to be affecting multiple PRs, would it be appropriate to 
attempt to increase the timeout duration as a temporary fix and open an issue 
for further investigation on the cause of the intermittent slowdown on those 
tests?

--
nosy: +aeros167

___
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-05 Thread pankaj . jangid
A S  writes:

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

This should work for the outer parenthesis:

import re

p = re.compile(r"\((.+)\)", re.VERBOSE)

with open('filename','r') as fd:
lines = fd.readlines()
for line in lines:
m = p.findall(line)
for s in m:
print(s)


-- 
Pankaj Jangid
-- 
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-05 Thread Antoon Pardon
On 4/09/19 17:46, Peter Otten wrote:
> 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)

I have been playing with this idea and it looks promising. I was wondering
about two points.

1) I guess I can add extra methods to my class through the metaclass by
   having something like the following in the registered function:

def registered(name, bases, namespace):
namespace["my_cool_functions"] = [
n for n, v in namespace.items()
if getattr(v, "registered", False)
]
namespace["__getitem__"] = lambda self, index: self.my_cool_functions[index]

2) Is it possible to make MyClass automatically a subclass of an other class
   through the metaclass?

-- 
Antoon.

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


[issue32689] shutil.move raises AttributeError if first argument is a pathlib.Path object and destination is a directory

2019-09-05 Thread Maxwell McKinnon


Change by Maxwell McKinnon :


--
nosy: +bodom

___
Python tracker 

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



[issue37402] Fatal Python error: Cannot recover from stack overflow issues on Python 3.6 and 3.7

2019-09-05 Thread hongweipeng


hongweipeng  added the comment:

According to the provided text.py file. `__exit__` will always execute due to 
the `with` syntax. It looks like this:
```
def rec():
try:
rec()
except RecursionError:
rec()

rec()
```

--
nosy: +hongweipeng

___
Python tracker 

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



Re: "How to protect the python code"

2019-09-05 Thread Chris Angelico
On Thu, Sep 5, 2019 at 6:50 PM Saba Kauser  wrote:
>
> Hello Experts,
>
> I am looking for ways available to protect the python source code from being 
> available to users for write/modify.

Run it on a server and don't let them see the source code.

> Is it a good idea to think that python source code can be protected?

Nope. If you're going to ship Python code for people to run on their
own systems - or, honestly, *any* code - you should assume that they
can read it themselves. The only way is to NOT ship the code, which
(in today's world) usually means publishing it as a web app.

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


"How to protect the python code"

2019-09-05 Thread Saba Kauser
Hello Experts,

I am looking for ways available to protect the python source code from being 
available to users for write/modify.
Is it a good idea to think that python source code can be protected?

I am aware that there are ways available to generate extensions like in C(.pyd 
files) and module the sensitive code likewise, but are there any better options 
available for protecting the native python source code itself. My requirement 
is to have the application/source in native python and not intermediate to 
other languages.

Please share your thoughts.

Thanks!

Saba Kauser
E: skau...@rocketsoftware.com
-



Rocket Software, Inc. and subsidiaries ? 77 Fourth Avenue, Waltham MA 02451 ? 
Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: 
https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - 
http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy


This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37934] Docs: Clarify NotImplemented use cases

2019-09-05 Thread Vedran Čačić

Vedran Čačić  added the comment:

Of course, if there are independent use cases already in the codebase, then my 
opinion is changed.

--

___
Python tracker 

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



[issue36409] plistlib old API should be removed

2019-09-05 Thread Ronald Oussoren


Ronald Oussoren  added the comment:


New changeset ce81a925ef2d466b0d801deaba9af44a0dfc2aa1 by Ronald Oussoren (Jon 
Janzen) in branch 'master':
bpo-36409: Remove old plistlib API deprecated in 3.4 (GH-15615)
https://github.com/python/cpython/commit/ce81a925ef2d466b0d801deaba9af44a0dfc2aa1


--

___
Python tracker 

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



[issue36324] Inverse cumulative normal distribution function

2019-09-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset f5649bfe7622447b302ef55e4db3a96b5840f8e8 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-36324:  Apply review comment from Jake Vanderplas (GH-15695) (GH-15696)
https://github.com/python/cpython/commit/f5649bfe7622447b302ef55e4db3a96b5840f8e8


--

___
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-05 Thread Antoon Pardon
On 4/09/19 17:46, Peter Otten wrote:
> 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)

Thanks for this idea. I think I can make this work for me.

-- 
Antoon.

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


[issue36324] Inverse cumulative normal distribution function

2019-09-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 9b51570ffd0494c07dafe10c7d2afe865754694c by Raymond Hettinger in 
branch 'master':
bpo-36324:  Apply review comment from Jake Vanderplas (GH-15695)
https://github.com/python/cpython/commit/9b51570ffd0494c07dafe10c7d2afe865754694c


--

___
Python tracker 

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



  1   2   >