Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
On Tuesday, 24 July 2018 14:25:48 UTC+10, Rick Johnson  wrote:
> Sayth Renshaw wrote:
> 
> > elements = [['[{0}]'.format(element) for element in elements]for elements 
> > in data]
> 
> I would suggest you avoid list comprehensions until you master long-form 
> loops.

I actually have the answer except for a glitch where on list element is an int.

My code

for item in data:
out = '[{0}]'.format("][".join(item))
print(out)

which prints out

[glossary]
[glossary][title]
[glossary][GlossDiv]
[glossary][GlossDiv][title]
[glossary][GlossDiv][GlossList]


However, in my source I have two lines like this

 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 
'GlossSeeAlso', 0],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 
'GlossSeeAlso', 1],

when it hits these lines I get 

TypeError: sequence item 6: expected str instance, int found

Do I need to do an explicit check for these 2 cases or is there a simpler way?

Cheers

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


[issue34177] test_site fails in macOS-PR VSTS builds for 3.7 branch

2018-07-23 Thread INADA Naoki


Change by INADA Naoki :


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

___
Python tracker 

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



Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
On Tuesday, 24 July 2018 14:25:48 UTC+10, Rick Johnson  wrote:
> Sayth Renshaw wrote:
> 
> > elements = [['[{0}]'.format(element) for element in elements]for elements 
> > in data]
> 
> I would suggest you avoid list comprehensions until you master long-form 
> loops.

My general issue is that I want to pick up all the elements in each sublist and 
operate on them to concatenate them together.

However, using for loops I get each list then each element of each list.
When in my head I want each list then all elements of each list.

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


Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
I am very close to the end result. I now have it as

Output
[   ['[glossary]'],
['[glossary]', '[title]'],
['[glossary]', '[GlossDiv]'],
['[glossary]', '[GlossDiv]', '[title]'],
['[glossary]', '[GlossDiv]', '[GlossList]'],
['[glossary]', '[GlossDiv]', '[GlossList]', '[GlossEntry]'],
.]

I used.

elements = [['[{0}]'.format(element) for element in elements]for elements in 
data]

Is there a good way to strip the ', ' and make the list a list of 1 element 
lists? Thoughts on achieving this?

So

[   ['[glossary]'],
['[glossary][title]'],
]

Cheers

Sayth

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


[issue34199] Add support for delete logger in log module.

2018-07-23 Thread Chetan kolhe


Chetan kolhe  added the comment:

Hi

Loggers are static objects managed by the module itself. When you create one, 
it won't be removed until you leave the shell

all logger instance is stored in this location.
"Logger.manager.loggerDict" which is the dictionary.
we can delete logger instance using that dictionary.

so why don't we give the support for deleting the logger object?

Scenario:-
I am writing the one Django project which consists produce the number of logger 
object depending on the requirement to store the log properly. Currently, I am 
using "Logger.manager.loggerDict" to delete unnecessary logger object using 
this dictionary. Currently, i have written code which deletes the parent to 
child logger object depending on their name. Storing those unrequired logger 
object in the current namespace is better to delete the logger object 
explicitly.

--

___
Python tracker 

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



[issue33073] Add as_integer_ratio() to int() objects

2018-07-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: Nofar Schnider -> lisroach
nosy: +lisroach

___
Python tracker 

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



[issue34149] Behavior of the min/max with key=None

2018-07-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Alexander, thanks for the suggestion and patch.

--
components: +Library (Lib)
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



[issue34149] Behavior of the min/max with key=None

2018-07-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset e22072fb11246f125aa9ff7629c832b9e2407ef0 by Raymond Hettinger 
(Alexander Marshalov) in branch 'master':
bpo-34149: Behavior of the min/max with key=None (GH-8328)
https://github.com/python/cpython/commit/e22072fb11246f125aa9ff7629c832b9e2407ef0


--

___
Python tracker 

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



[issue34202] 3.6 ZipFile fails with Path

2018-07-23 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks for the report! Support for path-like objects was added in 3.6.2. I 
think you either have 3.6.0 or 3.6.1 installed on your system. Please upgrade 
it to the latest bugfix release.

With 3.6.6, I got the following results:

>>> import zipfile
>>> from pathlib import Path
>>> path = Path('spam.zip')
>>> zf = zipfile.ZipFile(path, 'w')
>>> zf.writestr('test.txt', 'Hello, Sailor!')
>>> zf.close()

$ ./python -m zipfile -l spam.zip 
File Name Modified Size
test.txt   2018-07-24 06:10:52   14

--
nosy: +berker.peksag
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34198] Additional encoding options to tkinter.filedialog

2018-07-23 Thread Narito Takizawa


Change by Narito Takizawa :


--
pull_requests: +7955

___
Python tracker 

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



[issue34202] 3.6 ZipFile fails with Path

2018-07-23 Thread bbayles


Change by bbayles :


--
nosy: +bbayles

___
Python tracker 

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



Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw


> > 
> > for item in data:
> > for elem in item:
> > out = ("[{0}]").format(elem)
> > print(out)
> 
> Hint: print implicitly adds a newline to the output string. So collect all 
> the values of each sublist and print a line-at-time to output, or use the 
> end= argument of Py3's print, or find another solution. Also remember that 
> indention is significant in Python.

Thanks

Getting closer.

answer = []
for item in data:
for elem in item:
out = ("[{0}]").format(elem)
answer.append(out)

print(answer)

Think I need to bring it in a list not an element of a list and process it.

Cheers

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


[issue34198] Additional encoding options to tkinter.filedialog

2018-07-23 Thread Narito Takizawa


Change by Narito Takizawa :


--
pull_requests:  -7938

___
Python tracker 

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



Re: curses, ncurses or something else

2018-07-23 Thread eryk sun
On Mon, Jul 23, 2018 at 10:24 PM, John Pote  wrote:
>
> So I thought it might be quick and easy to do something with curses to keep
> the title line visable while the numbers roll up the screen. But alas I'm a
> Windows user and the 'curses' module is not in the Windows standard library
> for Python.

Try this versions, based on PDCurses:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34203] documentation: recommend Python 3 over 2 in faq

2018-07-23 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

Yep. Please propose a patch.

I think this should be updated even for Python 2.7 docs, which is nearing EOL.

--
nosy: +Mariatta
stage:  -> needs patch
versions: +Python 2.7, 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



Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
I have data which is a list of lists of all the full paths in a json document.

How can I change the format to be usable when selecting elements?

data = [['glossary'],
 ['glossary', 'title'],
 ['glossary', 'GlossDiv'],
 ['glossary', 'GlossDiv', 'title'],
 ['glossary', 'GlossDiv', 'GlossList'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'ID'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'SortAs'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossTerm'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'Acronym'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'Abbrev'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 'para'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 
'GlossSeeAlso'],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 
'GlossSeeAlso', 0],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 
'GlossSeeAlso', 1],
 ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossSee']]

I am trying to change it to be.

[['glossary'],
 ['glossary']['title'],
 ['glossary']['GlossDiv'],
]

Currently when I am formatting I am flattening the structure(accidentally).

for item in data:
for elem in item:
out = ("[{0}]").format(elem)
print(out)

Which gives

[glossary]
[title]
[GlossDiv]
[title]
[GlossList]
[GlossEntry]
[ID]
[SortAs]
[GlossTerm]
[Acronym]
[Abbrev]
[GlossDef]
[para]
[GlossSeeAlso]
[0]
[1]
[GlossSee]


Cheers

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


[issue34203] documentation: recommend Python 3 over 2 in faq

2018-07-23 Thread abcdef


New submission from abcdef :

FAQ "How stable is Python" 
https://docs.python.org/3/faq/general.html#how-stable-is-python; states

"There are two recommended production-ready versions at this point in time, 
because at the moment there are two branches of stable releases: 2.x and 3.x. 
Python 3.x may be less useful than 2.x, since currently there is more third 
party software available for Python 2 than for Python 3. Python 2 code will 
generally not run unchanged in Python 3."

According to git blame, this is from 2009. Could we change this to recommend 
Python 3 over Python 2 now?

--
assignee: docs@python
components: Documentation
messages: 322273
nosy: abcdef, docs@python
priority: normal
severity: normal
status: open
title: documentation: recommend Python 3 over 2 in faq
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: Python 2.7.14 and Python 3.6.0 netcdf4

2018-07-23 Thread MRAB

On 2018-07-23 23:39, jorge.conr...@cptec.inpe.br wrote:



   Hi,

   Please someone can help me with this error message;


   for Python 2.7.14 I did:

   from netCDF4 import Dataset

   and I didn't have no message


That's because you've installed netCDF4 for Python 2.7.



   But, for Python 3.6.0

   from netCDF4 import Dataset

   I had:

   Traceback (most recent call last):
   File "", line 1, in 
   ModuleNotFoundError: No module named 'netCDF4'


That's because you haven't installed netCDF4 for Python 3.6.



   What can I do to solve this error for Python 3.6.0


Install that module.

Assuming that you're using Windows, try this in a console window:

py -3.6 -m pip install netCDF4
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7.14 and Python 3.6.0 netcdf4

2018-07-23 Thread Steven D'Aprano
On Mon, 23 Jul 2018 19:39:18 -0300, jorge.conrado wrote:

>   Traceback (most recent call last):
>   File "", line 1, in 
>   ModuleNotFoundError: No module named 'netCDF4'
> 
> 
>   What can I do to solve this error for Python 3.6.0

Just because you have the Python 2.7 version of the netCDF4 module 
installed in the Python 2.7 environment, doesn't mean it will magically 
work for Python 3.6. You have to install the module for 3.6 as well.

How did you install it for Python 2.7?


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: Python 2.7.14 and Python 3.6.0 netcdf4

2018-07-23 Thread Thomas Jollans
On 24/07/18 00:39, jorge.conr...@cptec.inpe.br wrote:
>  from netCDF4 import Dataset
> 
>  I had:
> 
>  Traceback (most recent call last):
>  File "", line 1, in 
>  ModuleNotFoundError: No module named 'netCDF4'
> 
> 
>  What can I do to solve this error for Python 3.6.0

Install netCDF4 in your Python 3.6 environment.

Depending on what OS and Python distribution you're using, the thing to
do might be

py -3 -m pip install netCDF4

or

pip3 install netCDF4

(or something involving conda if you use anaconda)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34202] 3.6 ZipFile fails with Path

2018-07-23 Thread Michael Kleehammer


New submission from Michael Kleehammer :

ZipFile is documented to accept "path-like" objects but is failing when I try 
to create one.  I've distilled it down to this small test:

import zipfile
from pathlib import Path

path = Path('test.zip')
zf = zipfile.ZipFile(path, 'w')
zf.writestr('test.txt', 'Hello, Sailor!')
zf.close()

On macOS I'm getting this error:

Traceback (most recent call last):
  File "test.py", line 7, in 
zf.writestr('test.txt', 'Hello, Sailor!')
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", 
line 1644, in writestr
with self.open(zinfo, mode='w') as dest:
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", 
line 1348, in open
return self._open_to_write(zinfo, force_zip64=force_zip64)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", 
line 1461, in _open_to_write
self.fp.write(zinfo.FileHeader(zip64))
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", 
line 721, in write
n = self.fp.write(data)
AttributeError: 'PosixPath' object has no attribute 'write'

Using str(path) works fine.

--
components: Library (Lib)
messages: 322272
nosy: mkleehammer
priority: normal
severity: normal
status: open
title: 3.6 ZipFile fails with Path
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: curses, ncurses or something else

2018-07-23 Thread Thomas Jollans
On 24/07/18 00:24, John Pote wrote:
> Ideas invited.

This doesn't answer your question at all, but when I want a small script
to produce largish streams of numbers, I write them to a (csv) file and
plot them using matplotlib then and there.

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


Re: curses, ncurses or something else

2018-07-23 Thread Dale Marvin via Python-list

On 7/23/18 3:24 PM, John Pote wrote:
I recently wrote a command line app to take a stream of numbers, do some 
signal processing on them and display the results on the console. There 
may be several output columns of data so a title line is printed first. 
But the stream of numbers may be several hundred long and the title line 
disappears of the top on the console.


So I thought it might be quick and easy to do something with curses to 
keep the title line visable while the numbers roll up the screen. But 
alas I'm a Windows user and the 'curses' module is not in the Windows 
standard library for Python.


It occured to me that I could create a simple tkinter class but I 
haven't tinkered for some time and would have to refresh my knowledge of 
the API. Just wondered if there was any other simple way I could keep 
the title line on the console, preferably without having to install 
another library.


Ideas invited.




You didn't tell us much about your application but for analysis and 
display I like Jupiter Notebook. Plus it's easy to add graphs etc.


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


[issue13407] tarfile doesn't support multistream bzipped tar files

2018-07-23 Thread Andrés Delfino

Change by Andrés Delfino :


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

___
Python tracker 

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



Re: curses, ncurses or something else

2018-07-23 Thread Rich Shepard

On Mon, 23 Jul 2018, John Pote wrote:


So I thought it might be quick and easy to do something with curses to
keep the title line visable while the numbers roll up the screen. But alas
I'm a Windows user and the 'curses' module is not in the Windows standard
library for Python.


John,

  I don't recall if urwid  supports windows, but it has
more display and UI capabilities than either curses or ncurses. Urwid is a
console widget library for python.

HTH,

Rich

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


Re: Python shuts down when I try to run a module

2018-07-23 Thread Michael Torrie
On 07/23/2018 01:00 AM, Lyra wrote:
> Hello,
> I’ve just started to learn Python coding, and downloaded version 3.7.0 from 
> the website.  I’ve written 5 or 6 small programs and saved them, but whenever 
> I try to run them, Python doesn’t work right.  The user answers the first 
> question and presses ENTER, but then the Python window just closes, 
> disappears, and shuts down.  My programs are all written correctly, and work 
> just like they’re supposed to, when I run them in the Shell window instead.  
> There are no error messages.
> I went into the original installation file of Python and clicked on “Repair”. 
>  There was a progress bar, and it said “Repair completed”, but the problem 
> still occurs.
> I don’t want to uninstall the whole thing and download a different version 
> until after I hear from someone here who knows more about it than I do.

This is expected behavior on Windows.  Unless your program has a
graphical user interface that you've created, the proper way to run an
*interactive* python program is from the command prompt.  Alternatively
you can run it from within IDLE or some other Python IDE like PyCharm.
So you're not doing anything wrong. Just don't run them by double
clicking; run them from a command prompt instead.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 2.7.14 and Python 3.6.0 netcdf4

2018-07-23 Thread jorge . conrado




 Hi,

 Please someone can help me with this error message;


 for Python 2.7.14 I did:

 from netCDF4 import Dataset

 and I didn't have no message



 But, for Python 3.6.0

 from netCDF4 import Dataset

 I had:

 Traceback (most recent call last):
 File "", line 1, in 
 ModuleNotFoundError: No module named 'netCDF4'


 What can I do to solve this error for Python 3.6.0


 Thanks,


 Conrado

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


[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ec729d5407adafaae566136448ef0551bb29c070 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. 
(GH-8262) (GH-8424)
https://github.com/python/cpython/commit/ec729d5407adafaae566136448ef0551bb29c070


--

___
Python tracker 

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



curses, ncurses or something else

2018-07-23 Thread John Pote
I recently wrote a command line app to take a stream of numbers, do some 
signal processing on them and display the results on the console. There 
may be several output columns of data so a title line is printed first. 
But the stream of numbers may be several hundred long and the title line 
disappears of the top on the console.


So I thought it might be quick and easy to do something with curses to 
keep the title line visable while the numbers roll up the screen. But 
alas I'm a Windows user and the 'curses' module is not in the Windows 
standard library for Python.


It occured to me that I could create a simple tkinter class but I 
haven't tinkered for some time and would have to refresh my knowledge of 
the API. Just wondered if there was any other simple way I could keep 
the title line on the console, preferably without having to install 
another library.


Ideas invited.


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


Re: ongoing browser projects

2018-07-23 Thread Akkana Peck
> > On 23/07/18 03:43, Akkana Peck wrote:
> >> You'd think there would be something newer (ideally
> >> based on Blink) that worked with GTK3/GIO, but I never found anything.

Thomas Jollans writes:
> > This gi-based example looks like Gtk3, right?
> 
> https://gist.github.com/kklimonda/890640#file-pybrowser-py-L14

Sure enough, that works, at least with the webkit in Debian's
gir1.2-webkit-3.0 package. It didn't work with gir1.2-webkit2-4.0:
  File "", line 888, in _find_spec"
  AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
and then various further errors resulting from those; but at
least it's possible to make a Python 3, GTK3, webkit 3.0 browser.
And it even handles fullscreen events (like from youtube), something
I've never managed in QtWebEngine.

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


[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 220afffb683af1ba9e04c37535cfaa41348e9ebb by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. 
(GH-8262) (GH-8423)
https://github.com/python/cpython/commit/220afffb683af1ba9e04c37535cfaa41348e9ebb


--

___
Python tracker 

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



[issue34183] Lib/test/test_contextlib_async.py failed when ran as a script

2018-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue34184] Lib/test/test_dataclasses.py failed when ran as a script

2018-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue34183] Lib/test/test_contextlib_async.py failed when ran as a script

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 519fc551d7778ac698033846bb052a12b7d491e2 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-34183: Fix running Lib/test/test_contextlib_async.py as a script. (GH-8381) 
(GH-8422)
https://github.com/python/cpython/commit/519fc551d7778ac698033846bb052a12b7d491e2


--

___
Python tracker 

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



[issue30863] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Only after removing PyUnicode_AsUnicodeAndSize() and related PyArg_ParseTuple 
codes.

--

___
Python tracker 

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



[issue34190] x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3

2018-07-23 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Jeroen Demeyer for the good and quick fix! I applied it to 3.7 and 
master branches.

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



[issue34190] x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3

2018-07-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 25b87d35675301a929982db6d3783af4f715 by Victor Stinner (Miss 
Islington (bot)) in branch '3.7':
bpo-34190: Fix reference leak in call_function() (GH-8413) (GH-8418)
https://github.com/python/cpython/commit/25b87d35675301a929982db6d3783af4f715


--

___
Python tracker 

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



[issue30863] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2018-07-23 Thread STINNER Victor


STINNER Victor  added the comment:

Would it be possible to remove the wchar_t* cache?

--

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread Tal Einat


Tal Einat  added the comment:

Thanks for the PR, Matthias Bussonnier!

--
nosy: +mbussonn
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread Tal Einat


Tal Einat  added the comment:


New changeset 4e166ffd29b675238ccd94964743f6cb206d2235 by Tal Einat (Miss 
Islington (bot)) in branch '3.7':
bpo-33468: Add try-finally contextlib.contextmanager example (GH-7816) (GH-8425)
https://github.com/python/cpython/commit/4e166ffd29b675238ccd94964743f6cb206d2235


--

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread Tal Einat


Tal Einat  added the comment:


New changeset 5b3643d1a5114551350a9d17fb0aaab2d503c290 by Tal Einat (Miss 
Islington (bot)) in branch '3.6':
bpo-33468: Add try-finally contextlib.contextmanager example (GH-7816) (GH-8426)
https://github.com/python/cpython/commit/5b3643d1a5114551350a9d17fb0aaab2d503c290


--

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread Tal Einat


Tal Einat  added the comment:


New changeset f7e60a69485097dc28f000c55615038278f84333 by Tal Einat in branch 
'2.7':
[2.7] bpo-33468: Add try-finally contextlib.contextmanager example (GH-7816) 
(GH-8427)
https://github.com/python/cpython/commit/f7e60a69485097dc28f000c55615038278f84333


--

___
Python tracker 

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



[issue34021] [2.7] test_regrtest: test_env_changed() fails on x86 Windows XP VS9.0 2.7

2018-07-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Another failure in sx86 Windows XP VS9.0 2.7:

https://buildbot.python.org/all/#/builders/105/builds/195

Total duration: 28 min 12 sec
Tests result: FAILURE then FAILURE
test test_regrtest failed -- Traceback (most recent call last):
  File 
"d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py",
 line 665, in test_env_changed
output = self.run_tests("--fail-env-changed", testname, exitcode=3)
  File 
"d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py",
 line 335, in run_tests
return self.run_python(cmdargs, **kw)
  File 
"d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py",
 line 216, in run_python
proc = self.run_command(args, **kw)
  File 
"d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py",
 line 211, in run_command
self.fail(msg)
AssertionError: Command 
['d:\\cygwin\\home\\db3l\\buildarea\\2.7.bolen-windowsvs9\\build\\PC\\VS9.0\\python_d.exe',
 '-m', 'test', '--testdir=c:\\docume~1\\db3l\\locals~1\\temp\\tmpqsasla', 
'--fail-env-changed', 'test_regrtest_noop33'] failed with exit code 0
stdout:
---
Run tests sequentially
0:00:00 [1/1] test_regrtest_noop33
== Tests result: SUCCESS ==
1 test OK.
Total duration: 20 ms
Tests result: SUCCESS
---
stderr:
---
d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\support\__init__.py:808:
 RuntimeWarning: tests may fail, unable to create temp dir: 
d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\build\test_python_2916
  with temp_dir(path=name, quiet=quiet) as temp_path:
---

--

___
Python tracker 

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



[issue34184] Lib/test/test_dataclasses.py failed when ran as a script

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 635338248f967728f13b7bc4b9969aedff51eef6 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-34184: Fix running Lib/test/test_dataclasses.py as a script. (GH-8382) 
(GH-8421)
https://github.com/python/cpython/commit/635338248f967728f13b7bc4b9969aedff51eef6


--

___
Python tracker 

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



Re: Non-GUI, single processort inter process massaging - how?

2018-07-23 Thread Chris Green
Anders Wegge Keller  wrote:
> På Sat, 21 Jul 2018 09:07:23 +0100
> Chris Green  skrev:
> 
> > So - what's the best approach to this?  I've done some searching and
> > most/many of the solutions seem rather heavyweight for my needs. Am I
> > overlooking something obvious or should I try rethinking the original
> > requirement and look for another approach?
> 
>  What do you consider heavyweight? Number of dependencies, memory footprint,
> amount of code or a fourth thing? Also, which platform will the code
> eventually run on?
> 
>  If your update frequency is low enough that it wont kill the filesystem and
> the amount of data is reasonably small, atomic writes to a file is easy to
> work with:
> 
Yes, I think you're right, using a file would seem to be the best
answer.  Sample rate is only one a second or slower and there's not a
huge amount of data involved.

Thanks.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +7953

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7952

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread Tal Einat


Tal Einat  added the comment:


New changeset bde782bb594edffeabe978abeee2b7082ab9bc2a by Tal Einat (Matthias 
Bussonnier) in branch 'master':
bpo-33468: Add try-finally contextlib.contextmanager example (GH-7816)
https://github.com/python/cpython/commit/bde782bb594edffeabe978abeee2b7082ab9bc2a


--

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7951

___
Python tracker 

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



[issue32500] PySequence_Length() raises TypeError on dict type

2018-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32500] PySequence_Length() raises TypeError on dict type

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a6fdddb7df00aefad2ec6e362dbf10d4bd8bff32 by Serhiy Storchaka in 
branch 'master':
bpo-32500: Fix error messages for sequence and mapping C API. (GH-7846)
https://github.com/python/cpython/commit/a6fdddb7df00aefad2ec6e362dbf10d4bd8bff32


--

___
Python tracker 

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



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7950

___
Python tracker 

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



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7949

___
Python tracker 

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



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset aba24ff3601ddc86b85e01880a8be596fb799287 by Serhiy Storchaka in 
branch 'master':
bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. 
(GH-8262)
https://github.com/python/cpython/commit/aba24ff3601ddc86b85e01880a8be596fb799287


--

___
Python tracker 

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



[issue34183] Lib/test/test_contextlib_async.py failed when ran as a script

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7948

___
Python tracker 

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



[issue32752] no information about accessing typing.Generic type arguments

2018-07-23 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue34183] Lib/test/test_contextlib_async.py failed when ran as a script

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset db8e3a1e4476620b2b5aaf57acfc3ef58a08213b by Serhiy Storchaka in 
branch 'master':
bpo-34183: Fix running Lib/test/test_contextlib_async.py as a script. (GH-8381)
https://github.com/python/cpython/commit/db8e3a1e4476620b2b5aaf57acfc3ef58a08213b


--

___
Python tracker 

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



[issue34184] Lib/test/test_dataclasses.py failed when ran as a script

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7947

___
Python tracker 

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



[issue34184] Lib/test/test_dataclasses.py failed when ran as a script

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 3fe5cccb08283f5f4817ac432560972a4c0f5290 by Serhiy Storchaka in 
branch 'master':
bpo-34184: Fix running Lib/test/test_dataclasses.py as a script. (GH-8382)
https://github.com/python/cpython/commit/3fe5cccb08283f5f4817ac432560972a4c0f5290


--

___
Python tracker 

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



Re: Tracking a memory leak in C extension - interpreting the output of PYTHONMALLOCSTATS

2018-07-23 Thread Thomas Jollans
On 23/07/18 20:02, Bartosz Golaszewski wrote:
> Hi!

Hey!

> A user recently reported a memory leak in python bindings (C extension
> module) to a C library[1] I wrote. I've been trying to fix it since
> but so far without success. Since I'm probably dealing with a space
> leak rather than actual memory leak, valgrind didn't help much even
> when using malloc as allocator. I'm now trying to use
> PYTHONMALLOCSTATS but need some help on how to interpret the output
> emitted it's enabled.

Oh dear.

> 
> [snip]
> 
> The number of pools in arena 53 continuously grows. Its size column
> says: 432. I couldn't find any documentation on what it means but I
> assume it's an allocation of 432 bytes. [...]

I had a quick look at the code (because what else does one do for fun);
I don't understand much, but what I can tell you is that
 (a) yes, that is an allocation size in bytes, and
 (b) as you can see, it uses intervals of 8. This means that pool 53
 is used for allocations of 424 < nbytes <= 432 bytes. Maybe your
 breakpoint needs tweaking.
 (c) Try breaking on _PyObject_Malloc or pymalloc_alloc. I think they're
 called by both PyMem_Malloc and PyObject_Malloc.

int _PyObject_DebugMallocStats(FILE *out)

https://github.com/python/cpython/blob/b18f8bc1a77193c372d79afa79b284028a2842d7/Objects/obmalloc.c#L2435

static int pymalloc_alloc(void *ctx, void **ptr_p, size_t nbytes)

https://github.com/python/cpython/blob/b18f8bc1a77193c372d79afa79b284028a2842d7/Objects/obmalloc.c#L1327


Have fun debugging!

-- Thomas


> 
> How do I use the info produced by PYTHONMALLOCSTATS do get to the
> culprit of the leak? Is there anything wrong in my reasoning here?
> 
> Best regards,
> Bartosz Golaszewski
> 
> [1] https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
> 

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


Re: Want to be a rockstar programmer?

2018-07-23 Thread Brian Oney via Python-list
meh, I'm more into 90s and 00s metal rock and punk rock. Oh well, I knew it 
wasn't meant to be. ;)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22323] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(): don't cache the result

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Oh, I have reimplemented this in issue30863.

--

___
Python tracker 

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



[issue30863] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Victor already wrote similar patch in issue22323.

--

___
Python tracker 

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



[issue30863] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2018-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
Removed message: https://bugs.python.org/msg322251

___
Python tracker 

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



[issue30863] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Victor already wrote similar patch in issue16254.

--

___
Python tracker 

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



[issue15127] Supressing warnings with -w "whether gcc supports ParseTuple"

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This code was removed in f6b687fcd4d62e53443e23376dc02c177fecc0d4.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23927] getargs.c skipitem() doesn't skip 'w*'

2018-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue23927] getargs.c skipitem() doesn't skip 'w*'

2018-07-23 Thread Joe Jevnik


Change by Joe Jevnik :


--
pull_requests: +7946

___
Python tracker 

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



[issue34189] Add simple tests for new Tk widget options

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset fbcb6fae6233efbde1f6bb9fe51e33baec4767b8 by Serhiy Storchaka in 
branch '2.7':
bpo-34189: Remove a file backported by accident. (GH-8419)
https://github.com/python/cpython/commit/fbcb6fae6233efbde1f6bb9fe51e33baec4767b8


--

___
Python tracker 

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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-23 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

On, yes, I think I missed the first point, earlier. Thank You! I did the 
changes.

--

___
Python tracker 

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



[issue34189] Add simple tests for new Tk widget options

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good point Zackery!

--

___
Python tracker 

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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-23 Thread Tim Peters


Tim Peters  added the comment:

Nick suggested two changes on 2018-07-15 (look above).  Mark & I agreed about 
the first change, so it wasn't mentioned again after that.  All the rest has 
been refining the second change.

--

___
Python tracker 

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



[issue34189] Add simple tests for new Tk widget options

2018-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7945

___
Python tracker 

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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-23 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Hey Tim,

> @CuriousLearner, does the PR also include Nick's first suggested change?  
> Here:

"""
=
Bitwise operations only make sense for integers. The result of bitwise 
operations is calculated as though carried out in two's complement with an 
infinite number of sign bits.
=
"""

I think it was then discussed to keep this line as:

"""
===
Bitwise operations only make sense for integers. Negative numbers are treated 
as their 2's complement value.
===
"""

Does this needs to be changed?

Here is the link of the PR: 
https://github.com/python/cpython/pull/1691/files#diff-7498e907ba97646df434a0eb583c6909

--

___
Python tracker 

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



[issue13407] tarfile doesn't support multistream bzipped tar files

2018-07-23 Thread Andrés Delfino

Andrés Delfino  added the comment:

Sorry, you are right. I'll try on 2.7 when I get home, and make a PR if needed.

--

___
Python tracker 

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



[issue13407] tarfile doesn't support multistream bzipped tar files

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a 2.7 only documentation issue.

--

___
Python tracker 

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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-23 Thread Tim Peters


Tim Peters  added the comment:

@CuriousLearner, does the PR also include Nick's first suggested change?  Here:

"""
1. Replace the opening paragraph of 
https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types
 (the one I originally quoted when opening this issue) with the text:

=
Bitwise operations only make sense for integers. The result of bitwise 
operations is calculated as though carried out in two's complement with an 
infinite number of sign bits.
=
"""

--

___
Python tracker 

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



[issue34191] argparse: Missing subparser error message should be more clear

2018-07-23 Thread paul j3


paul j3  added the comment:

Updating you Python3.7 might change the behavior.  If I read

https://github.com/python/cpython/commits/master/Lib/argparse.py

correctly, subparsers are no longer required by default (it reverted back to 
earlier Py3 behavior).  There is a proposed patch for handling this 'dest=None' 
issue, but I don't think that's been pushed.

But simply adding the 'dest' to subparses should work without update.  If you 
want to identify which subparser was used, you need this 'dest'.

--

___
Python tracker 

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



[issue8525] Display exceptions' subclasses in help()

2018-07-23 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Hi,

My perception with all the discussion and WIP patch is that we can ideally 
limit the no. of subclasses shown only for object, and not for any other class.

>From that list, the only unhelpful ones with > 4 items, in my opinion, appear 
>to be `object`, since that just tells you every type that exists, and `tuple`, 
>because that lists every single namedtuple.

> So it is USEFUL to know ALL subclasses of a given Exception class

+1

> I agree with this - most of the value here comes from showing the full set of 
> exceptions. If we don't do that, we should probably point the user to calling 
> `cls.__subclasses__()` so they can inspect the full list

I agree with this. I would propose to only limit to 4 classes for subclasses of 
`object` and for everything else displaying all the subclasses. We can 
optionally display the message to call `cls.__subclasses()` in the case when 
`help(object)` is called.

How does it sound?

--

___
Python tracker 

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



Want to be a rockstar programmer?

2018-07-23 Thread Larry Martell
https://github.com/dylanbeattie/rockstar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyCharm

2018-07-23 Thread Michael Vilain
I used the pycharm edu version from here:

https://www.jetbrains.com/pycharm-edu/download/download-thanks.html?platform=mac

input works fine on it. YMMV.


> On 20-Jul-2018, at 9:15 PM , no@none.invalid wrote:
> 
> On Fri, 20 Jul 2018 20:56:41 -0700, Michael Vilain
>  wrote:
> 
>> I'm running PyCharm Edu (to go through their great tutorial). It's version 
>> is 2018.1.3, which I got from the web site.  Unless you mistyped the 
>> version, this is the current release and yours is very old.
> 
> The date was just from a message posted back in Jan.
> 
> My version  says:
> PyCharm 2018.1.4 (Community Edition)
> Build #PC-181.5087.37, built on May 24, 2018
> JRE: 1.8.0_152-release-1136-b39 amd64
> JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
> Windows 7 6.1
> 
> When I try to use an input statment, the program freezes.  I have to
> terminate it.
> 
> What happens when you try to run code with an input statment?
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Tracking a memory leak in C extension - interpreting the output of PYTHONMALLOCSTATS

2018-07-23 Thread Bartosz Golaszewski
Hi!

A user recently reported a memory leak in python bindings (C extension
module) to a C library[1] I wrote. I've been trying to fix it since
but so far without success. Since I'm probably dealing with a space
leak rather than actual memory leak, valgrind didn't help much even
when using malloc as allocator. I'm now trying to use
PYTHONMALLOCSTATS but need some help on how to interpret the output
emitted it's enabled.

I'm setting PYTHONMALLOCSTATS=1 & PYTHONMALLOC=pymalloc_debug and then
running the script that triggers the leak. The last debug message is
as follows:

class   size   num pools   blocks in use  avail blocks
-      -   -  
3 32   1   2   124
4 40   2   9   193
5 48   1   381
6 56   1   468
7 64  11 295   398
8 72   9 260   244
9 80  36 831   969
   10 88  791542  2092
   11 96 1313262  2240
   12104  701903   757
   13112  19 289   395
   14120  11 139   224
   15128   7  88   129
   16136   6  70   104
   17144   5  4496
   18152   4  4757
   19160  24 342   258
   20168   4  1779
   21176  24 360   192
   22184   2   836
   23192   2  1131
   24200  22 227   213
   25208   3  1344
   26216   3   747
   27224   2  1323
   28232   2   628
   29240   3   840
   30248   2  1022
   31256   3  1035
   32264   2   921
   33272   3  1131
   34280   2  1018
   35288   1   311
   36296   2   917
   37304   2   917
   38312   2   519
   39320   2   519
   40328  14 10563
   41336   2   321
   42344   1   3 8
   43352   1   3 8
   44360   2   319
   45368   1   3 8
   46376   1   1 9
   47384   2   416
   48392   2   614
   49400   2   317
   50408   1   1 8
   51416   1   3 6
   52424   2   414
   53432   50967  45868023
   54440   3   918
   55448   4  1521
   56456   4  1220
   57464   3   816
   58472   2   511
   59480   1   4 4
   60488   1   3 5
   61496   4  1121
   62504   4  1319
   63512   2   7 7

# times object malloc called   =2,811,245
# arenas allocated total   =  810
# arenas reclaimed =0
# arenas highwater mark=  810
# arenas allocated current =  810
810 arenas * 262144 bytes/arena=  212,336,640

# bytes in allocated blocks=  199,277,432
# bytes in available blocks=1,138,472
308 unused pools * 4096 bytes  =1,261,568
# bytes lost to pool headers   =2,473,536
# bytes lost to quantization   =8,185,632
# bytes lost to arena alignment=0
Total  =  212,336,640

The number of pools in arena 53 continuously grows. Its size column
says: 432. I couldn't find any documentation on what it means but I
assume it's an allocation of 432 bytes. I launched gdb and set 

[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-23 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Seems good to me. I've made the changes in the PR.

--

___
Python tracker 

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



[issue34189] Add simple tests for new Tk widget options

2018-07-23 Thread Zackery Spytz


Zackery Spytz  added the comment:

It appears that a file was backported to 2.7 by accident.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue29710] Incorrect representation caveat on bitwise operation docs

2018-07-23 Thread Mark Dickinson


Mark Dickinson  added the comment:

> 4. Performing these calculations with at least one extra sign extension bit 
> in a finite two's complement representation (a working bit-width of ``1 + 
> max(x.bit_length(), y.bit_length()`` or more) is sufficient to get the same 
> result as if there were an infinite number of sign bits.

LGTM

--

___
Python tracker 

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



[issue13407] tarfile doesn't support multistream bzipped tar files

2018-07-23 Thread Andrés Delfino

Andrés Delfino  added the comment:

This is no longer reproducible under 3.7.0.

>>> import tarfile
>>> tf = tarfile.open("kdelibs-4.7.3.tar.bz2", "r")
>>> print(len(tf.getnames()))
9237

Not sure I should be the one closing this.

--
nosy: +adelfino

___
Python tracker 

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



[issue30400] Race condition in shutil.copyfile(): source file replaced file during copy

2018-07-23 Thread Preston Moore

Preston Moore  added the comment:

Hey everyone,

I have updated the pull request to include a version of copyfile() that 
attempts to address the discussed race condition by open()’ing a file 
descriptor to the relevant files as early as possible and maintaining it 
throughout processing.  In order for this to work I had to use some lower level 
posix-only features. Specifically, I had to open() the files non-blocking 
initially and using fcntl() to make them blocking once some initial checks have 
been performed.  The functions behavior under Windows should be unchanged.  I 
chose this course because Windows doesn’t support fcntl() or os.open() with 
O_NONBLOCK.

I will add a few additional tests around the new checks and get things ready 
for a merge.  I would also be glad to use a strategy of this nature to fix 
similar bugs in the other areas discussed above.

Thanks,
Preston

--

___
Python tracker 

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



Re: Python shuts down when I try to run a module

2018-07-23 Thread Neil Cerutti
On 2018-07-23, Calvin Spealman  wrote:
> This is an unfortunate property of running command line
> programs on Windows. If you run the script directly (like by
> double clicking on it?) the console window will close when the
> program is done, so you can't see the final output.
>
> To get around this you could run them in the IDLE editor, which
> comes with Python 3.7 for Windows, or you could open a windows
> command prompt and run your Python scripts from there.

You can also put

input("Press [Enter] to exit.")

at the end of your program, though unfortunately it doesn't help
when an error occurs, requiring you to put it in a finally block
to ensure it happens.

-- 
Neil Cerutti

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


[issue32752] no information about accessing typing.Generic type arguments

2018-07-23 Thread Jared Deckard


Jared Deckard  added the comment:

typing_inspect is now filled with python version checks for 3.7. The 
implementation got significantly more complex when differentiating generics at 
runtime.

3.6 was undocumented, but the OO API was intuitive:

>>> T = typing.Union[int, float]
>>> assert T.__class__ == typing.Union
>>> assert T.__args__ == (int, float)

3.7 is less convenient and less consistent:

>>> T = typing.Union[int, float]
>>> assert T.__class__ == typing._GenericAlias
>>> assert T.__origin__ == typing.Union
>>> L = typing.List[int]
>>> assert L.__class__ == typing._GenericAlias
>>> assert L.__origin__ == list

--
nosy: +Jared Deckard

___
Python tracker 

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



[issue34188] Allow dict choices to "transform" values in argpagse

2018-07-23 Thread paul j3


paul j3  added the comment:

The 'choices' mechanism is a simple 'value in choices' test.  A dictionary (or 
other mapping) works because it works with 'in'.

'type' as noted is the means that argparse provides for transforming an input 
string into some other object (most commonly a number with 'int' or 'float').  
The choices test is performed after the type transformation.

The 'set_defaults()' with subparsers is offered almost as a parenthetical idea, 
and has nothing to do with 'choices' or 'type'.  'set_defaults' is just another 
way of setting default values, and works even with 'dest' which aren't 
otherwise defined.  If that isn't clear, I'd suggest testing it with the main 
parser.  

In Python functions are first class objects, and thus can be used just like 
strings or numbers - assigned to variables, put in lists, etc.  

In:

   adict = {'I':int, 'F':float}
   parser.add_argument('foo', type=lambda x: adict.get(x), 
choices=adict.values())

the 'type' transforms the commandline string into a the dictionary value, and 
'choices' then tests that against the values of the dictionary.  (I had to use 
`lambda` instead of 'adict.get' directly because of testing that 'type' does.)

--
nosy: +paul.j3

___
Python tracker 

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



[issue34190] x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7944

___
Python tracker 

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



[issue34190] x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3

2018-07-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 147d95511f59cfdd2d522f9d736f2335457bae20 by Victor Stinner 
(jdemeyer) in branch 'master':
bpo-34190: Fix reference leak in call_function() (GH-8413)
https://github.com/python/cpython/commit/147d95511f59cfdd2d522f9d736f2335457bae20


--

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-07-23 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

> What other object in the standard lib, leaks resources when deleted in 
> CPython ?

Threads come to mind, for example:

>>> import time, threading, weakref
>>> t = threading.Thread(target=time.sleep, args=(10,))
>>> t.start()
>>> wr = weakref.ref(t)
>>> del t
>>> wr()


Note I'm not against fixing this issue, just saying it's not that surprising 
for Pool to keep lingering around when you lost any user-visible reference to 
it.

--

___
Python tracker 

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



Python in the news

2018-07-23 Thread Rich Shepard

  The lead article in science section and technology section of this week's
'The Economist' is about Python:


Enjoy,

Rich

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


[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-07-23 Thread tzickel


tzickel  added the comment:

I think I've found the code bug causing the leak:

https://github.com/python/cpython/blob/caa331d492acc67d8f4edd16542cebfabbbe1e79/Lib/multiprocessing/pool.py#L180

There is a circular reference between the Pool object, and the 
self._worker_handler Thread object (and it's also saved in the frame locals for 
the thread object, which prevents it from being garbage collected).

--

___
Python tracker 

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



[issue34170] Py_Initialize(): computing path configuration must not have side effect (PEP 432)

2018-07-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7943

___
Python tracker 

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



[issue34191] argparse: Missing subparser error message should be more clear

2018-07-23 Thread paul j3


paul j3  added the comment:

Your code runs fine under 3.6.5.

But if I add 'subparsers.required=True', I get your error.  It's having 
problems formatting the name of the subparsers command when issuing the error 
message.

If I add a 'dest' to the add_subparsers I get the expected error message:

import argparse

parser = argparse.ArgumentParser(description="Automatically process XML")
subparsers = parser.add_subparsers(title='subcommands', dest='cmd')
subparsers.required=True
chain_parser = subparsers.add_parser('chain', aliases=['c'], 
help='Automatically run a chain of transformations')

args = parser.parse_args()
print(args)

The default 'dest' for subparsers is None, and the error arises from

','.join([None])

The problems with a missing 'dest' came up in earlier discussions about making 
required/not required subparsers.  3.7 made subparsers 'required' by default, 
but it appears that it hasn't addressed this missing 'dest' problem.

But I haven't followed the latest release details closely.

--
nosy: +paul.j3

___
Python tracker 

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



[issue34174] argparse formatter_class issue for RawDescriptionHelpFormatter

2018-07-23 Thread paul j3


paul j3  added the comment:

argparse does import 'textwrap', but as '_textwrap', so it could be used with:

argparse._textwrap.dedent(...)

Importing your own is cleaner.

--
nosy: +paul.j3

___
Python tracker 

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



[issue8525] Display exceptions' subclasses in help()

2018-07-23 Thread Eric Wieser


Eric Wieser  added the comment:

> I get the following results for builtin objects that have defined subclasses

>From that list, the only unhelpful ones with > 4 items, in my opinion, appear 
>to be `object`, since that just tells you every type that exists, and `tuple`, 
>because that lists every single namedtuple.

> So it is USEFUL to know ALL subclasses of a given Exception class

I agree with this - most of the value here comes from showing the full set of 
exceptions. If we don't do that, we should probably point the user to calling 
`cls.__subclasses__()` so they can inspect the full list

--
nosy: +Eric.Wieser

___
Python tracker 

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



[issue34046] subparsers -> add_parser doesn't support hyphen char '-'

2018-07-23 Thread paul j3


paul j3  added the comment:

Do you understand why this is happening?

Subparsers is, in effect, a positional argument with 'choices' - the choices 
being the parsers (and their aliases).

But '-dr' looks like an flagged (optionals) argument.  Since you didn't define 
such an argument, it gets put in the 'unrecognized' category.

So, no, you can't used a flag-like name for a parser.  Why are you trying to do 
this?

--
nosy: +paul.j3

___
Python tracker 

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



  1   2   3   >