[issue30749] Non-atomic and unusual (wrong) rename behavior under OS X

2017-06-25 Thread Ronald Oussoren

Ronald Oussoren added the comment:

What version of macOS did you test on?

--

___
Python tracker 

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



[issue6739] IDLE: refuse invalid key bindings

2017-06-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Guilherme, thank you for the patch.  Sorry it took so long to be applied.  
Cheryl, thank you for making the PR.  Writing invalid, exception-raising 
sequences to user config files was a definite bug.

--
resolution:  -> fixed
stage: test needed -> 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



[issue6739] IDLE: refuse invalid key bindings

2017-06-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 64a0c266e78c6b5363668012fa7fb614f6018930 by terryjreedy in branch 
'3.6':
[3.6] bpo-6739: IDLE: Check for valid keybinding in config_keys (GH-2377) 
(#2397)
https://github.com/python/cpython/commit/64a0c266e78c6b5363668012fa7fb614f6018930


--

___
Python tracker 

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



[issue29304] dict: simplify lookup functions

2017-06-25 Thread Tim Peters

Tim Peters added the comment:

Oops!  I undercounted the shifts in the current scheme:  there's an additional 
shift for "perturb".  That doesn't exist in the "double hashing" alternatives.

--

___
Python tracker 

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



[issue29304] dict: simplify lookup functions

2017-06-25 Thread Tim Peters

Tim Peters added the comment:

I suggest reading the thread I started here[1] before pursuing this:  it looks 
very likely that the entire collision resolution scheme should be replaced with 
one of the "double hashing" ones given there, a bona fide algorithmic 
improvement for small tables and pathological key sets.  Whether it actually 
runs faster remains a mystery ;-)  The loop guts change from a shift, three 
adds, and a mask (or a multiply, two adds, and a mask) to just one add and a 
mask.  But the post-first-probe pre-loop setup gets more expensive.

[1] https://mail.python.org/pipermail/python-ideas/2017-June/046143.html

--
nosy: +tim.peters

___
Python tracker 

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



[issue30441] os.environ raises RuntimeError: dictionary changed size during iteration

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Osvaldo, could you please create a pull request on GitHub based on your first 
patch? But use list() instead of dict().

--

___
Python tracker 

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



[issue30747] _Py_atomic_* not actually atomic on Windows with MSVC

2017-06-25 Thread Jeffrey Yasskin

Jeffrey Yasskin added the comment:

Has enough time passed that you can use the C11 atomic types and operations 
instead of special-casing these for each compiler? (e.g. 
http://en.cppreference.com/w/c/atomic/atomic_store)

--

___
Python tracker 

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



[issue6739] IDLE: refuse invalid key bindings

2017-06-25 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2444

___
Python tracker 

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



[issue6739] IDLE: refuse invalid key bindings

2017-06-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 8c78aa70c888a370af18896a72cabd00e4120f09 by terryjreedy 
(csabella) in branch 'master':
bpo-6739: IDLE: Check for valid keybinding in config_keys (#2377)
https://github.com/python/cpython/commit/8c78aa70c888a370af18896a72cabd00e4120f09


--

___
Python tracker 

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



[issue29304] dict: simplify lookup functions

2017-06-25 Thread Xavier G. Domingo

Changes by Xavier G. Domingo :


--
nosy: +xgdomingo

___
Python tracker 

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



Re: GUI Designer[s]

2017-06-25 Thread Ben Finney
Edward Montague  writes:

>   I'd like to eventually have 3D graphics within an application

For that requirement, your application will need to make use of a
library for presenting and interacting with 3D objects.

To my knowledge there is no such thing in the standard library, so
you'll need to bring in a third-party distribution for that.

> constructed through a GUI Designer ; preferably with quality
> approaching or exceeding that of MayaVI2.

I haven't used Blender  for a separate
Python program, but I know that people like its Python API
.

-- 
 \   “Most people are other people. Their thoughts are someone |
  `\  else’s opinions, their lives a mimicry, their passions a |
_o__)   quotation.” —Oscar Wilde, _De Profundis_, 1897 |
Ben Finney

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


[issue30757] pyinstaller can be added to docs, py2exe ref can be updated

2017-06-25 Thread Denis Akhiyarov

Changes by Denis Akhiyarov :


--
pull_requests: +2443

___
Python tracker 

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



[issue30757] pyinstaller can be added to docs, py2exe ref can be updated

2017-06-25 Thread Denis Akhiyarov

New submission from Denis Akhiyarov:

https://github.com/python/cpython/pull/1158

It is not clear why this FAQ item is written in addition to this document:

https://github.com/python/cpython/blob/master/Doc/faq/windows.rst#how-do-i-make-python-scripts-executable

https://github.com/python/cpython/blob/master/Doc/faq/programming.rst#how-can-i-create-a-stand-alone-binary-from-a-python-script

--
assignee: docs@python
components: Documentation
messages: 296844
nosy: denfromufa, docs@python
priority: normal
severity: normal
status: open
title: pyinstaller can be added to docs, py2exe ref can be updated
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, 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



[issue30756] ttk: GUI tests fail on Ubuntu

2017-06-25 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue30756] ttk: GUI tests fail on Ubuntu

2017-06-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My Win 10 machine consistently runs 272 tests OK in 3 seconds.

--

___
Python tracker 

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



GUI Designer[s]

2017-06-25 Thread Edward Montague
 I've become a bit more familiar with wxglade , wxFormBuilder and to a
lesser extent BoaConstructor.

 There are however numerous other possiblities and
extensions .
  I'd like to eventually have 3D graphics within an
application constructed through a GUI Designer ;
preferably with quality approaching or exceeding that
of MayaVI2.

 Is there any project underway to meld the plethora
of possibilties into something more comprehensive as
a GUI Designer.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30734] 200000 indexes crashes eval and python (without eval)

2017-06-25 Thread Nick Coghlan

Nick Coghlan added the comment:

We have quite a few of them: 
https://github.com/python/cpython/tree/master/Lib/test/crashers

Python 2.7 is ancient, so our tolerance for intrusive interpreter level fixes 
to address rare problems that are easy to avoid at the development level is 
pretty low.

Fixing those kinds of problems in Python 3.x is encouraged, but still not 
necessarily easy.

--

___
Python tracker 

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



[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Sorry, I wasn't clear: I don't see any problem for the cases that don't 
optimize local variable access, and don't think any of those should change.

Instead, I think we should tighten up the formal specification of locals() to 
better match how it is actually used in practice: 
https://mail.python.org/pipermail/python-dev/2013-May/125917.html

(https://bugs.python.org/issue17960 is the corresponding issue, although I 
clearly got distracted by other things and never followed up with a patch for 
the language reference. https://bugs.python.org/issue17546 is another issue 
lamenting the current underspecification in this area)

However, function bodiess are already inherently different from other execution 
namespaces, and that stems from a particular special case assumption that we 
don't make anywhere else: we assume that at compile time, the compiler can see 
all of the names added to the local namespace of a function.

That assumption wasn't quite valid in Python 2 (since unqualified exec 
statements and function level wildcard imports could mess with it), but it's 
much closer to being true in Python 3.

Checking the 3.7 code, the only remaining ways to trigger it are:

- via a tracing function (since LocalsToFast gets called after the tracing 
function runs)
- by injecting an IMPORT_STAR opcode into a function code object (the compiler 
disallows that in Python 3 and emits a SyntaxWarning for it in Python 2, but 
the LocalsToFast call is still there in the eval loop)

So I think an entirely valid way forward here would be to delete LocalsToFast 
in 3.7+, and say that if you want to write access to a function namespace from 
outside the function, you need to either implement an eval hook (not just a 
tracing hook), or else use a closure that closes over all the variables that 
you want write access to.

However, the less drastic way forward would be to make it so that writing a 
tracing function is the only way to get access to the FastToLocals result, and 
have locals() on a frame running a code object compiled for fast locals return 
f->f_locals.copy() rather than a direct reference to the original.

--

___
Python tracker 

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



Re: comments and the continuation prompt

2017-06-25 Thread Ben Finney
Steve D'Aprano  writes:

> On Mon, 26 Jun 2017 08:44 am, Stefan Ram wrote:
>
> >   According to The Python Language Reference Release 3.6.0, 2.1.3
> >   Comments, »A comment signifies the end of the logical line unless
> >   the implicit line joining rules are invoked.«.
> > 
> >   So, why do I get a continuation prompt when I enter a comment?
>
> Why not? As far as the interactive interpreter is concerned, you
> haven't yet entered a statement.

And yet, according to the Language Reference, the logical line has ended
and another begun.

So I think the question is worth exploring: Why does the interactive
prompt imply the logical line is continuing, when the Language Reference
would say otherwise?

Maybe the answer is “the continuation prompt does not prompt for the
continuation of a logical line, but the continuation of ”.

What exactly goes in the “” placeholder; that is,
exactly what should the user understand by that transition from one
prompt to a different one?

-- 
 \   “Philosophy is questions that may never be answered. Religion |
  `\  is answers that may never be questioned.” —anonymous |
_o__)  |
Ben Finney

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


[issue17960] Clarify the required behaviour of locals()

2017-06-25 Thread Nick Coghlan

Changes by Nick Coghlan :


--
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue30756] ttk: GUI tests fail on Ubuntu

2017-06-25 Thread Louie Lu

Changes by Louie Lu :


--
components: +Tkinter
title: GUI tests fail on Ubuntu -> ttk: GUI tests fail on Ubuntu

___
Python tracker 

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



Re: comments and the continuation prompt

2017-06-25 Thread Steve D'Aprano
On Mon, 26 Jun 2017 08:44 am, Stefan Ram wrote:

>   When I enter »12\«, I get a continuation prompt in the
>   Python 3.6 console:
> 
 12\
> ...
> 
>   . I thought that this might indicate that the logical line
>   is not terminated yet.

No. You get the level 2 prompt (sys.ps2) for a number of reasons:

- after statements that require a block (def, class, if, while, for, 
  with, try, and any others I have missed);

- in triple-quoted strings;

- bracketed expressions which haven't been closed yet ( [ { 

- after comments.

 
>   According to The Python Language Reference Release 3.6.0,
>   2.1.3 Comments, »A comment signifies the end of the logical
>   line unless the implicit line joining rules are invoked.«.
> 
>   So, why do I get a continuation prompt when I enter a comment?

Why not? As far as the interactive interpreter is concerned, you haven't yet
entered a statement.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue30576] http.server should support HTTP compression (gzip)

2017-06-25 Thread Glenn Linderman

Glenn Linderman added the comment:

"veery" should be "veering" in above comment, sorry.

--

___
Python tracker 

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



[issue30576] http.server should support HTTP compression (gzip)

2017-06-25 Thread Glenn Linderman

Glenn Linderman added the comment:

Martin, I understood what you meant, but sadly, doing that least to confusion. 
Follow your link, it displays fine, and then save the file. At least in 
Firefox, the default name to save as is "nGzip — A File Compressor.html". This 
looks appropriate, but the saved file is actually the compressed .gz form, so 
attempting to display it later, from the default name, displays the compressed 
gibberish, because the name does not reflect the encoding. Perhaps this should 
be considered a Firefox bug? Chrome saves the uncompressed version with the 
same default name. I can't actually figure out how to save the file from Edge, 
so don't know what it might do.

I'm surprised that Firefox, since it saves the compressed version, didn't offer 
the name "index.en.html.gz", and that Chrome, for the uncompressed version, 
didn't offer "index.en.html". Deriving the name from the title feels weird, but 
maybe only because I create web pages, and know what the real file names are. 
But this paragraph, other than the lack of ".gz" for Firefox naming, is veery 
off-topic.

The point I'm trying to make, though, is that the URIs shouldn't contain file 
extensions that include the compression, because that is confusing. The 
compression should be an internally negotiated detail between the browser and 
the web server, and the URI should reflect the content to be displayed, not the 
form in which it was encoded for transfer (or storage).  When .gz or .br is 
included in the URI, I would expect the browser to offer to save it to disk as 
a binary, compressed file, just like .zip. The variant behavior of Firefox and 
Chrome makes me wonder if there is even a standard that applies in this area... 
if there is, and if either one of them is following it, it is certainly not 
what I would expect.

--

___
Python tracker 

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



[issue30749] Non-atomic and unusual (wrong) rename behavior under OS X

2017-06-25 Thread Alex Groce

Alex Groce added the comment:

Checked, and this is a problem on Python 3 as well as 2.7.

--
title: Non-atomic and unusual (wrong) rename behavior under OS X, Python 2.7.13 
-> Non-atomic and unusual (wrong) rename behavior under OS X
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



[issue30687] build.bat should locate msbuild.exe rather than vcvarsall.bat

2017-06-25 Thread Steve Dower

Steve Dower added the comment:

The bug is  MSBuild 15.0 should be able to locate earlier versions of VC, even 
if you haven't installed it for VS 2017.

--

___
Python tracker 

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



[issue24813] Redesign Help => About IDLE, make it non-modal

2017-06-25 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Created issue 30756.

On Sun, Jun 25, 2017 at 2:10 PM, Terry J. Reedy 
wrote:

>
> Terry J. Reedy added the comment:
>
> You should have enough data to open an issue; make Serhiy Storchaka (and
> me) nosy. Does the same test fail consistently or not?  % of failures. When
> it takes longer, is there a particular place in the stream of results where
> it pauses?  When I run it on master, it consistently takes 3 seconds, and
> there is a deprecation warning that I think should be caught in the test.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue30756] GUI tests fail on Ubuntu

2017-06-25 Thread Cheryl Sabella

New submission from Cheryl Sabella:

Running the tests over up to date build on Ubuntu 16.04 64-bit.

./python -m test.test_ttk_guionly -v


Sometimes this runs without failure and sometimes it 'hangs' and then produces 
failures.  When it hangs, my computer freezes completely.  As you can see, it 
can run for 8 minutes.

It seems to hang most often on test_idenify in EntryTest.

Here's one set of failures:

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.EntryTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
332, in test_identify
self.assertEqual(self.entry.identify(5, 5), "textarea")
AssertionError: '' != 'textarea'
+ textarea

==
FAIL: test_get (tkinter.test.test_ttk.test_widgets.ScaleTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
807, in test_get
self.assertEqual(self.scale.get(scale_width, 0), self.scale['to'])
AssertionError: 0.0 != 1.0

==
FAIL: test_set (tkinter.test.test_ttk.test_widgets.ScaleTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
849, in test_set
self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max)
AssertionError: 0.0 != 1.0

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.WidgetTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
71, in test_identify
), "label")
AssertionError: '' != 'label'
+ label

--
Ran 272 tests in 491.572s

FAILED (failures=4)



Here's another set from a different run:

==
FAIL: test_get (tkinter.test.test_ttk.test_widgets.ScaleTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
807, in test_get
self.assertEqual(self.scale.get(scale_width, 0), self.scale['to'])
AssertionError: 0.0 != 1.0

==
FAIL: test_set (tkinter.test.test_ttk.test_widgets.ScaleTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
849, in test_set
self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max)
AssertionError: 0.0 != 1.0

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.WidgetTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 
71, in test_identify
), "label")
AssertionError: '' != 'label'
+ label

==
FAIL: test_horizontal_range 
(tkinter.test.test_ttk.test_extensions.LabeledScaleTest)
--
Traceback (most recent call last):
  File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_extensions.py", 
line 122, in test_horizontal_range
self.assertEqual(prev_xcoord, int(linfo_1['x']))
AssertionError: 16 != 1

--
Ran 272 tests in 353.180s

FAILED (failures=4)

--
components: Tests
messages: 296835
nosy: csabella, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
status: open
title: GUI tests fail on Ubuntu
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



Re: comp.lang.python killfile rule

2017-06-25 Thread Mirage Web Studio
Just felt like posting, wouldn't it be pythonic if it was
if word in [list]:
ignore

Save time and easily maintainable

Cmg

On 23 Jun 2017 02:41, "John Black"  wrote:

All, in case this is useful to anyone, this rule that tells my newsreader
which posts to kill really cleans up the group.  I could not find a way
to key off of anything in the header except keywords because the From
keeps changing and I didn't want to overkill real posts.  I may have to
add a thing or two to this over time, but right now, this seems to be
nailing everything.

John Black

Subject contains "PEDOFILO"
Or
Subject contains "MAI"
Or
Subject contains "SEGRETO"
Or
Subject contains "SETTA"
Or
Subject contains "BAMBINI"
Or
Subject contains "FIGLIO"
Or
Subject contains "PAOLO"
Or
Subject contains "NATALE"
Or
Subject contains "SONO"
Or
Subject contains "GRAZIA"
Or
Subject contains "PORNOSTAR"
Or
Subject contains "PEZZO"
Or
Subject contains "MERDA"
Or
Subject contains "CAZZO"
Or
Subject contains "GALERA"
Or
Subject contains "SICARIO"
Or
Subject contains "ESSERE"
Or
Subject contains "CRIMINALE"
Or
Subject contains "LECCA"
Or
Subject contains "COCAINA"
Or
Subject contains "LESBICA"
Or
Subject contains "NESSUNO"
Or
Subject contains "MAFIOSO"
Or
Subject contains "BERLUSCONI"
Or
Subject contains ""
Or
Subject contains "HARDCORE"
Or
Subject contains "PEDERASTA"
Or
Subject contains "CULO"
Or
Subject contains "NOSTRA"
Or
Subject contains "FOGLIO"
Or
Subject contains "USARE"
Or
Subject contains "FAMIGLIA"
Or
Subject contains "FECE"
Or
Subject contains "CAPO"
Or
Subject contains "SUICIDARE"
Or
Subject contains "OGNI"
Or
Subject contains "CANE"
Or
Subject contains "MERCATO"
Or
Subject contains "VOLTA"
Or
Subject contains "MAFIOSA"
Or
Subject contains "ALMENO"
Or
Subject contains "BASTARDO"
Or
Subject contains "FIGLIA"
Or
Subject contains "BASTARD"
Or
Subject contains "CRIMINAL"
Or
Subject contains "ANNI"
Or
Subject contains "PEDINA"
--
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24813] Redesign Help => About IDLE, make it non-modal

2017-06-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

You should have enough data to open an issue; make Serhiy Storchaka (and me) 
nosy. Does the same test fail consistently or not?  % of failures. When it 
takes longer, is there a particular place in the stream of results where it 
pauses?  When I run it on master, it consistently takes 3 seconds, and there is 
a deprecation warning that I think should be caught in the test.

--

___
Python tracker 

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



[issue30734] 200000 indexes crashes eval and python (without eval)

2017-06-25 Thread George Shuklin

George Shuklin added the comment:

Unfixed crash of code interpreter? This is sad.

--

___
Python tracker 

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



[issue7985] access to infinitely recursive list

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Correction to the last message. Issue5765 was a 3.x issue. It was fixed for 
3.3+, and it was decided to not fix it for 2.7 and 3.2. This issue is not 
reproduced in 3.3+.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30734] 200000 indexes crashes eval and python (without eval)

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Which is a duplicate of issue5765 fixed for Python 3.3+. It was decided to not 
fix issue5765 for 2.7.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> stack overflow evaluating eval("()" * 3)

___
Python tracker 

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



[issue27945] Various segfaults with dict

2017-06-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2442

___
Python tracker 

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



Re: Checking for an exception

2017-06-25 Thread Steve D'Aprano
On Mon, 26 Jun 2017 02:40 am, Skip Montanaro wrote:

>> py> isinstance(KeyboardInterrupt(), Exception)
>> False
>> py> isinstance(ValueError, Exception)
>> False
>>
> 
> I might have missed something, but don't you want to be using BaseException
> as your class/type? 

Yes I do, which is why I was demonstrating to Paul that his suggestion to use
Exception instead of BaseException is not good enough.

*wink*

> Also, Checking isinstance() between two classes isn't 
> likely to work, I don't think.

Indeed it doesn't, which is why I was demonstrating that Paul's suggestion to
use isinstance instead of issubclass is not good enough.

*wink*


> Both the 2.7 and 3.6 docs indicate that BaseException is the base class for
> all built-in exceptions:

Indeed it is. Which is why in my original post I used BaseException.

*eye spasms from winking too much*


> https://docs.python.org/2/library/exceptions.html
> https://docs.python.org/3/library/exceptions.html
> 
> Of course, YMMV when dealing with user-defined exception classes.

No, user-defined exceptions must derive from BaseException too.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


exception_guard context manager and decorator

2017-06-25 Thread Steve D'Aprano
As discussed in the Python-Ideas mailing list, sometimes we want to suppress a
particular kind of exception and replace it with another.

For that reason, I'd like to announce exception_guard, a context manager and
decorator which catches specified exceptions and replaces them with a given
exception (RuntimeError by default).

https://code.activestate.com/recipes/580808-guard-against-an-exception-in-the-wrong-place/

or just

https://code.activestate.com/recipes/580808


It should work with Python 2.6 through 3.6 and later.

try:
with exception_guard(ZeroDivisionError):
1/0  # raises ZeroDivisionError
except RuntimeError:
print ('ZeroDivisionError replaced by RuntimeError')


See the recipe on ActiveState for links to discussions on Python-Ideas.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue30734] 200000 indexes crashes eval and python (without eval)

2017-06-25 Thread Mark Dickinson

Mark Dickinson added the comment:

Looks like a duplicate of http://bugs.python.org/issue7985

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2017-06-25 Thread Matthew Woodcraft

Matthew Woodcraft added the comment:

That alias (C.UTF-8 to en_US.UTF-8) is surely a bug in itself nowadays. I've 
filed #30755 .

--
nosy: +mattheww

___
Python tracker 

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



[issue30755] locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8

2017-06-25 Thread Matthew Woodcraft

New submission from Matthew Woodcraft:

I have a system where the default locale is C.UTF-8, and en_US.UTF-8 is
not installed.

But locale.normalize() unhelpfully converts "C.UTF-8" to "en_US.UTF-8".

So the following crashes for me:

  python3.6 -c "import locale;locale.setlocale(locale.LC_ALL, ('C', 'UTF-8'))"


Similarly getdefaultlocale() returns ('en_US', 'UTF-8'), so this crashes too:

  export LANG=C.UTF-8
  unset LC_CTYPE
  unset LC_ALL
  unset LANGUAGE
  python3.6 -c "import locale;locale.setlocale(locale.LC_ALL, 
locale.getdefaultlocale())"


This behaviour is caused by a locale_alias entry in Lib/locale.py .

https://bugs.python.org/issue20076 documents its addition but doesn't
provide a rationale.

I can see that it might be helpful to provide such a conversion if
C.UTF-8 doesn't exist and en_US.UTF-8 does, but the current code is
breaking modern correctly-configured systems for the benefit of old
misconfigured ones (C.UTF-8 shouldn't really be in the environment if it
isn't available on the system, after all).

--
messages: 296828
nosy: mattheww
priority: normal
severity: normal
status: open
title: locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8
versions: Python 3.4, 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



Re: Checking for an exception

2017-06-25 Thread D'Arcy Cain

On 06/25/17 12:10, Steve D'Aprano wrote:

py> isinstance(KeyboardInterrupt(), Exception)
False
py> isinstance(ValueError, Exception)
False


That's because KeyboardInterrupt is not a subclass of Exception.  If you 
want to catch that as well you need to check against BaseException.


https://docs.python.org/3.6/library/exceptions.html#exception-hierarchy

--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list


Re: Checking for an exception

2017-06-25 Thread Skip Montanaro
>
> py> isinstance(KeyboardInterrupt(), Exception)
> False
> py> isinstance(ValueError, Exception)
> False
>

I might have missed something, but don't you want to be using BaseException
as your class/type? Also, Checking isinstance() between two classes isn't
likely to work, I don't think.

Both the 2.7 and 3.6 docs indicate that BaseException is the base class for
all built-in exceptions:

https://docs.python.org/2/library/exceptions.html
https://docs.python.org/3/library/exceptions.html

Of course, YMMV when dealing with user-defined exception classes.

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


Re: Checking for an exception

2017-06-25 Thread Steve D'Aprano
On Sun, 25 Jun 2017 05:50 pm, Paul Rubin wrote:

> Steve D'Aprano  writes:
>> What's the right/best way to test whether an object is an exception
>> ahead of time? (That is, without trying to raise from it.)
> 
> Maybe I'm missing something but
>isinstance(obj, Exception)
> seems to work.

Not well enough I'm afraid:



py> isinstance(KeyboardInterrupt(), Exception)
False
py> isinstance(ValueError, Exception)
False





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue24813] Redesign Help => About IDLE, make it non-modal

2017-06-25 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Sometimes that test fails and sometimes it doesn't, even if I run it several 
times in a row.  When it does fail, it runs a lot longer than when it doesn't.  
So, I'm trying to figure out the difference before reporting it.  Since the 
failure takes time, I'm thinking it might be resource contention of some sort.

--

___
Python tracker 

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



[issue30687] build.bat should locate msbuild.exe rather than vcvarsall.bat

2017-06-25 Thread Pär Björklund

Pär Björklund added the comment:

I don't believe that this is a bug in Visual Studio as MSBuild is used for .NET 
projects as well it should be available even without the C++ tooling installed.

Checking for the targets file seems like a workable solution.

--

___
Python tracker 

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



ANN: SciPy 0.19.1 release

2017-06-25 Thread Ralf Gommers
On behalf of the Scipy development team I am pleased to announce the
availability of Scipy 0.19.1. This is a bugfix-only release, no new
features are included.

This release requires Python 2.7 or 3.4-3.6 and NumPy 1.8.2 or greater.
Source tarballs and release notes can be found at
https://github.com/scipy/scipy/releases/tag/v0.19.1.
OS X and Linux wheels are available from PyPI:
https://pypi.python.org/pypi/scipy/0.19.1

Thanks to everyone who contributed!

Cheers,
Ralf



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

==
SciPy 0.19.1 Release Notes
==

SciPy 0.19.1 is a bug-fix release with no new features compared to 0.19.0.
The most important change is a fix for a severe memory leak in
``integrate.quad``.


Authors
===

* Evgeni Burovski
* Patrick Callier +
* Yu Feng
* Ralf Gommers
* Ilhan Polat
* Eric Quintero
* Scott Sievert
* Pauli Virtanen
* Warren Weckesser

A total of 9 people contributed to this release.
People with a "+" by their names contributed a patch for the first time.
This list of names is automatically generated, and may not be fully
complete.


Issues closed for 0.19.1
- 

- - `#7214 `__: Memory use in
integrate.quad in scipy-0.19.0
- - `#7258 `__:
``linalg.matrix_balance`` gives wrong transformation matrix
- - `#7262 `__: Segfault in
daily testing
- - `#7273 `__:
``scipy.interpolate._bspl.evaluate_spline`` gets wrong type
- - `#7335 `__:
scipy.signal.dlti(A,B,C,D).freqresp() fails


Pull requests for 0.19.1
- 

- - `#7211 `__: BUG: convolve may
yield inconsistent dtypes with method changed
- - `#7216 `__: BUG: integrate:
fix refcounting bug in quad()
- - `#7229 `__: MAINT: special:
Rewrite a test of wrightomega
- - `#7261 `__: FIX: Corrected
the transformation matrix permutation
- - `#7265 `__: BUG: Fix broken
axis handling in spectral functions
- - `#7266 `__: FIX 7262: ckdtree
crashes in query_knn.
- - `#7279 `__: Upcast half- and
single-precision floats to doubles in BSpline...
- - `#7336 `__: BUG: Fix
signal.dfreqresp for StateSpace systems
- - `#7419 `__: Fix several
issues in ``sparse.load_npz``, ``save_npz``
- - `#7420 `__: BUG: stats: allow
integers as kappa4 shape parameters


Checksums
=

MD5
~~~

72415e8da753eea97eb9820602931cb5
scipy-0.19.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
e0022540df2735eb0475071b266d5d71
scipy-0.19.1-cp27-cp27m-manylinux1_i686.whl
f513eb4ea2086de169a502df7efb91c7
scipy-0.19.1-cp27-cp27m-manylinux1_x86_64.whl
906c3c59209d6249b5d8ce14cfa01382
scipy-0.19.1-cp27-cp27mu-manylinux1_i686.whl
afbf8ffb4a4fe7c18e34cb8a313c18ee
scipy-0.19.1-cp27-cp27mu-manylinux1_x86_64.whl
5ba945b3404644244ab469883a1723f0
scipy-0.19.1-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
9c02cdd79e4ffadddcce7b2212039816
scipy-0.19.1-cp34-cp34m-manylinux1_i686.whl
79c0ba3618466614744de9a2f5362bbc
scipy-0.19.1-cp34-cp34m-manylinux1_x86_64.whl
602a741a54190e16698ff8b2fe9fd27c
scipy-0.19.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
d6c2ecadd4df36eb61870227fae42d3a
scipy-0.19.1-cp35-cp35m-manylinux1_i686.whl
e7167c0a9cf270f89437e2fd09731636
scipy-0.19.1-cp35-cp35m-manylinux1_x86_64.whl
fc2e4679e83590ff19c1a5c5b1aa4786
scipy-0.19.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
458615e9a56429a72038531dd5dcb3cb
scipy-0.19.1-cp36-cp36m-manylinux1_i686.whl
65b1667ac56861da4cbc609960ed735b
scipy-0.19.1-cp36-cp36m-manylinux1_x86_64.whl
b704ebe9a28b8fe83d9f238d40031266  scipy-0.19.1.tar.gz
cad6bac0638b176f72c00fe81ed54d19  scipy-0.19.1.tar.xz
eb69261e5026ef2f3b9ae827caa7e5b8  scipy-0.19.1.zip

SHA256
~~

1e8fedf602859b541ebae78667ccfc53158edef58d9ee19ee659309004565952
scipy-0.19.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
023ee29faa76c184a607e21076f097dc32f3abba7c71ece374588f95920aa993
scipy-0.19.1-cp27-cp27m-manylinux1_i686.whl
2a26d06a642e3c9107ca06df125f5dc5507abe2b87fd7865415d03ab654b0b43
scipy-0.19.1-cp27-cp27m-manylinux1_x86_64.whl
b3e97be2cd9f052d984fc5ba2d441897971b744c64d658617944c47bc366f8ff

Fwd: Unable to convert pandas object to string

2017-06-25 Thread Paul Barry
Forgot to include this reply to the list (as others may want to comment).

-- Forwarded message --
From: Paul Barry 
Date: 24 June 2017 at 12:21
Subject: Re: Unable to convert pandas object to string
To: Bhaskar Dhariyal 


Note that .info(), according to its docs, gives you a "Concise summary of a
DataFrame".  Everything is an object in Python, including strings, so the
output from .info() is technically correct (but maybe not very helpful in
your case).

As I've shown, we can work out that the data you want to work with is in
fact a string, so I've added some code to my notebook to show you how to
tokenize the first row of data.  This should get you started on doing this
to the rest of your data.

Note, too, that some of the data in these specific columns contains
something other than a string, so you'll need to clean up that first (see
the end of the updated notebook, attached, for how I worked out that this
was indeed the case).

I hope this all helps.

Paul.



On 24 June 2017 at 11:31, Bhaskar Dhariyal 
wrote:

> The data type showing there is object. In[4] in the first page. I wanted
> to tokenize the name & desc column and clean it
>
>
> On Sat, Jun 24, 2017 at 3:54 PM, Paul Barry 
> wrote:
>
>> Hi Bhaskar.
>>
>> Please see attached PDF of a small Jupyter notebook.  As you'll see, the
>> data in the fields you mentioned are *already* strings.  What is it you are
>> trying to do here?
>>
>> Paul.
>>
>> On 24 June 2017 at 10:51, Bhaskar Dhariyal 
>> wrote:
>>
>>> ​
>>>  train.csv
>>> 
>>> ​here it is thanks for quick reply
>>>
>>> On Sat, Jun 24, 2017 at 3:14 PM, Paul Barry 
>>> wrote:
>>>
 Any chance you could post one line of data so we can see what we have
 to work with?

 Also - have you taken a look at Jake VanderPlas's notebooks? There's
 lot of help with pandas to be found there: https://github.com/jake
 vdp/PythonDataScienceHandbook

 Paul.

 On 24 June 2017 at 10:32, Bhaskar Dhariyal 
 wrote:

> 
> Int64Index: 171594 entries, 0 to 63464
> Data columns (total 7 columns):
> project_id  171594 non-null object
> desc171594 non-null object
> goal171594 non-null float64
> keywords171594 non-null object
> diff_creat_laun 171594 non-null int64
> diff_laun_status171594 non-null int64
> diff_status_dead171594 non-null int64
> dtypes: float64(1), int64(3), object(3)
>
> not able to convert desc and keywords to string for preprocessing.
> Tried astype(str). Please help
> --
> https://mail.python.org/mailman/listinfo/python-list
>



 --
 Paul Barry, t: @barrypj  - w:
 http://paulbarry.itcarlow.ie - e: paul.ba...@itcarlow.ie
 Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland.

>>>
>>>
>>
>>
>> --
>> Paul Barry, t: @barrypj  - w:
>> http://paulbarry.itcarlow.ie - e: paul.ba...@itcarlow.ie
>> Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland.
>>
>
>


-- 
Paul Barry, t: @barrypj  - w:
http://paulbarry.itcarlow.ie - e: paul.ba...@itcarlow.ie
Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland.



-- 
Paul Barry, t: @barrypj  - w:
http://paulbarry.itcarlow.ie - e: paul.ba...@itcarlow.ie
Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30754] textwrap.dedent mishandles empty lines

2017-06-25 Thread Julian Berman

New submission from Julian Berman:

⊙  python2 -c 'from textwrap import dedent; print repr(dedent(" " * 2 + "\n" + 
" " * 4 + "\n"))'
'\n\n'

instead of the presumed '\n  \n'

The same appears to be the case for py3.6.


(At first glance, this seems unrelated to http://bugs.python.org/issue19479 
although that issue seems to have an unreviewed patch that changes the 
implementation, so it might also "accidentally" fix the issue).

--
components: Library (Lib)
messages: 296825
nosy: Julian, georg.brandl, terry.reedy
priority: normal
severity: normal
status: open
title: textwrap.dedent mishandles empty lines
type: behavior
versions: Python 2.7, Python 3.5, 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: os.walk the apostrophe and unicode

2017-06-25 Thread Rod Person
On Sun, 25 Jun 2017 08:18:45 -0600
Michael Torrie  wrote:

> On 06/25/2017 06:19 AM, Rod Person wrote:
> > But doing a simple ls of that directory show it is unicode but the
> > replacement of the offending character.
> > 
> > http://rodperson.com/graphics/uc/ls.png  
> 
> Now that is really strange.  Your OS seems to not recognize that the
> filename is in UTF-8.  I suspect this has something to do with the NAS
> file sharing protocol (smb). Though I'm pretty sure that Samba can
> handle UTF-8 filenames correctly.
> 
> > I am in fact using Python 3.5. I may be lacking in unicode skills
> > but I do have the sense enough to know the version of Python I am
> > invoking. So I included this screenshot of that so the version of
> > Python and the files list returned by os.walk
> > 
> > http://rodperson.com/graphics/uc/files.png  
> 
> If I create a file that has the U+2019 character in it on my Linux
> machine (BtrFS), and do os.walk on it, I see the character in then
> string properly.  So it looks like Python does the right thing,
> automatically decoding from UTF-8.
> 
> In your situation I think the problem is the file sharing protocol
> that your NAS is using. Somehow some information is being lost and
> your OS does not know that the filenames are in UTF-8, and just
> thinks they are bytes. And therefore Python doesn't know to decode
> the string, so you just end up with each byte being converted to a
> unicode code point and being shoved into the unicode string.
> 
> How to get around this issue I don't know.  Maybe there's a way to
> convert the unicode string to bytes using the value of each character,
> and then decode that back to unicode.

I think you theory is on the correct path. I'm actually attached to the
NAS via NFS not samba. And just quickly looking into that it seems the
NFS server needs and option set to pass unicode correctly...but my NAS
software doesn't allow my access to settings only to turn it on or off.

Looks like my option is the original correct the file name.


-- 
Rod

http://www.rodperson.com

Who at Clitorius fountain thirst remove 
Loath Wine and, abstinent, meer Water love.

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


Re: os.walk the apostrophe and unicode

2017-06-25 Thread Peter Otten
Rod Person wrote:

> Ok...so after reading all the replies in the thread, I thought I would
> be easier to send a general reply and include some links to screenshots.
> 
> As Peter mention, the logic thing to do would be to fix the file name
> to what I actually thought it was and if this was for work that
> probably what I would have done, but since I want to understand what's
> going on I decided to waste time on that.
> 
> I have to admit, I didn't think the file system was utf-8 as seeing what
> looked to be an apostrophe sent me down the road of why is this
> apostrophe screwed up instead of "ah this must be unicode".
> 
> But doing a simple ls of that directory show it is unicode but the
> replacement of the offending character.
> 
> http://rodperson.com/graphics/uc/ls.png

Have you set LANG to something that implies ASCII?

$ touch Todd’s ähnlich üblich löblich
$ ls
ähnlich  löblich  Todd’s  üblich
$ LANG=C ls
Todd???s  l??blich  ??hnlich  ??blich
$ python3 -c 'import os; print(os.listdir())'
['Todd’s', 'üblich', 'ähnlich', 'löblich']
$ LANG=C python3 -c 'import os; print(os.listdir())'
['Todd\udce2\udc80\udc99s', '\udcc3\udcbcblich', '\udcc3\udca4hnlich', 
'l\udcc3\udcb6blich']
$ LANG=en_US.utf-8 python3 -c 'import os; print(os.listdir())'
['Todd’s', 'üblich', 'ähnlich', 'löblich']

For file names Python resorts to surrogates whenever a byte does not 
translate into a character in the advertised encoding.
 
> I am in fact using Python 3.5. I may be lacking in unicode skills but I
> do have the sense enough to know the version of Python I am invoking.

I've made so many "stupid errors" myself that I always consider them first 
;)

> So I included this screenshot of that so the version of Python and the
> files list returned by os.walk
> 
> http://rodperson.com/graphics/uc/files.png
> 
> So the fact that it shows as a string and not bytes in the debugger was
> throwing me for a loop, in my log section I was trying to determine if
> it was unicode decode it...if not don't do anything which wasn't working
> 
> http://rodperson.com/graphics/uc/log_section.png
> 
> 
> 
> 
> On Sun, 25 Jun 2017 10:47:18 +0200
> Peter Otten <__pete...@web.de> wrote:
> 
>> Steve D'Aprano wrote:
>> 
>> > On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:
>> 
>> >> if everything worked correctly? Though I don't understand why the
>> >> OP doesn't see
>> >> 
>> >> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>> >> 
>> >> which is the repr() that I get.
>> > 
>> > That's mojibake and is always wrong :-)
>> 
>> Yes, that's my very point.
>> 
>> > I'm not sure how you got that.
>> 
>> I took the OP's string at face value and pasted it into the
>> interpreter:
>> 
>> # python 3.4
>> >>> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in
>> >>> Progress).flac'
>> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>> 
>> > Something to do with an accidental decode to Latin-1?
>> 
>> If the above filename is the only one or one of a few that seem
>> broken, and other non-ascii filenames look OK the OP's
>> toolchain/filesystem may work correctly and the odd name might have
>> been produced elsewhere, e. g. by copying an already messed-up
>> freedb.org entry.
>> 
>> [Heureka]
>> 
>> However, the most likely explanation is that the filename is correct
>> and that the OP is not using Python 3 as he claims but Python 2.
>> 
>> Yes, it took that long for me to realise ;) Python 2 is slowly
>> sinking into oblivion...
>> 
> 
> 
> 


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


Re: os.walk the apostrophe and unicode

2017-06-25 Thread Michael Torrie
On 06/25/2017 06:19 AM, Rod Person wrote:
> But doing a simple ls of that directory show it is unicode but the
> replacement of the offending character.
> 
> http://rodperson.com/graphics/uc/ls.png

Now that is really strange.  Your OS seems to not recognize that the
filename is in UTF-8.  I suspect this has something to do with the NAS
file sharing protocol (smb). Though I'm pretty sure that Samba can
handle UTF-8 filenames correctly.

> I am in fact using Python 3.5. I may be lacking in unicode skills but I
> do have the sense enough to know the version of Python I am invoking.
> So I included this screenshot of that so the version of Python and the
> files list returned by os.walk
> 
> http://rodperson.com/graphics/uc/files.png

If I create a file that has the U+2019 character in it on my Linux
machine (BtrFS), and do os.walk on it, I see the character in then
string properly.  So it looks like Python does the right thing,
automatically decoding from UTF-8.

In your situation I think the problem is the file sharing protocol that
your NAS is using. Somehow some information is being lost and your OS
does not know that the filenames are in UTF-8, and just thinks they are
bytes. And therefore Python doesn't know to decode the string, so you
just end up with each byte being converted to a unicode code point and
being shoved into the unicode string.

How to get around this issue I don't know.  Maybe there's a way to
convert the unicode string to bytes using the value of each character,
and then decode that back to unicode.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30703] test_multiprocessing_forkserver hangs on the master branch

2017-06-25 Thread Matt Billenstein

Matt Billenstein added the comment:

Yes, I'll email you the details.

--

___
Python tracker 

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



[issue30747] _Py_atomic_* not actually atomic on Windows with MSVC

2017-06-25 Thread Steve Dower

Steve Dower added the comment:

> Would there be any interest of implementing them for MSVC/ARM as well

Sure, since you're there. It's not easy to test, but I know people who are 
doing it, so it'll get noticed eventually.

Maybe there's some sort of stress test we can write that is likely to encounter 
issues? I've done that before to detect concurrency issues in particularly 
complex code.

--

___
Python tracker 

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



Re: os.walk the apostrophe and unicode

2017-06-25 Thread Rod Person
Ok...so after reading all the replies in the thread, I thought I would
be easier to send a general reply and include some links to screenshots.

As Peter mention, the logic thing to do would be to fix the file name
to what I actually thought it was and if this was for work that
probably what I would have done, but since I want to understand what's
going on I decided to waste time on that.

I have to admit, I didn't think the file system was utf-8 as seeing what
looked to be an apostrophe sent me down the road of why is this
apostrophe screwed up instead of "ah this must be unicode".

But doing a simple ls of that directory show it is unicode but the
replacement of the offending character.

http://rodperson.com/graphics/uc/ls.png

I am in fact using Python 3.5. I may be lacking in unicode skills but I
do have the sense enough to know the version of Python I am invoking.
So I included this screenshot of that so the version of Python and the
files list returned by os.walk

http://rodperson.com/graphics/uc/files.png

So the fact that it shows as a string and not bytes in the debugger was
throwing me for a loop, in my log section I was trying to determine if
it was unicode decode it...if not don't do anything which wasn't working

http://rodperson.com/graphics/uc/log_section.png




On Sun, 25 Jun 2017 10:47:18 +0200
Peter Otten <__pete...@web.de> wrote:

> Steve D'Aprano wrote:
> 
> > On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:  
> 
> >> if everything worked correctly? Though I don't understand why the
> >> OP doesn't see
> >> 
> >> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
> >> 
> >> which is the repr() that I get.  
> > 
> > That's mojibake and is always wrong :-)   
> 
> Yes, that's my very point. 
> 
> > I'm not sure how you got that.  
> 
> I took the OP's string at face value and pasted it into the
> interpreter:
> 
> # python 3.4
> >>> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in
> >>> Progress).flac'  
> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
> 
> > Something to do with an accidental decode to Latin-1?  
> 
> If the above filename is the only one or one of a few that seem
> broken, and other non-ascii filenames look OK the OP's
> toolchain/filesystem may work correctly and the odd name might have
> been produced elsewhere, e. g. by copying an already messed-up
> freedb.org entry.
> 
> [Heureka]
> 
> However, the most likely explanation is that the filename is correct
> and that the OP is not using Python 3 as he claims but Python 2.
> 
> Yes, it took that long for me to realise ;) Python 2 is slowly
> sinking into oblivion...
> 



-- 
Rod

http://www.rodperson.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: os.walk the apostrophe and unicode

2017-06-25 Thread alister
On Sun, 25 Jun 2017 02:23:15 -0700, wxjmfauth wrote:

> Le samedi 24 juin 2017 21:10:47 UTC+2, alister a écrit :
>> On Sat, 24 Jun 2017 14:57:21 -0400, Rod Person wrote:
>> 
>> > \xe2\x80\x99,
>> 
>> because the file name has been created using "Right single quote"
>> instead of apostrophe, the glyphs look identical in many fonts.
>> 
>> 
> Trust me. Fonts are clearly making distinction between \u0027 and
> \u2019.



Not all, and even when they do it has absolutely nothing to do with the 
point of the post
the character in the file name is \u2019 right quotation mark & not an 
apostrophe which the op was assuming.
he needs to decode the file name correctly 

-- 
You will be held hostage by a radical group.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30753] not able to execute print command on page 16 of documentation

2017-06-25 Thread Steven D'Aprano

Steven D'Aprano added the comment:

This is a bug in your code, not Python, and the error tells you how to fix it. 
You have to indent the block.

>>> while b < 1000:
... print(b, end=',')
... a, b = b, a+b

Remember to press TAB or spacebar inside indented blocks.

You should work through the tutorial.

https://docs.python.org/3/tutorial/index.html

By the way, you say page 16 of which documentation? Are you reading from a 
book? Which book?

--
nosy: +steven.daprano
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



[issue30753] not able to execute print command on page 16 of documentation

2017-06-25 Thread Vishal Devgn

New submission from Vishal Devgn:

>>> a, b = 0, 1
>>> while b < 1000:
... print(b, end=',')
... a, b = b, a+b

in 3.6 as soon as i write print command, it displays an indentation error.

--
files: 1.png
messages: 296821
nosy: Vishal Devgn
priority: normal
severity: normal
status: open
title: not able to execute print command on page 16 of documentation
type: compile error
versions: Python 3.6
Added file: http://bugs.python.org/file46974/1.png

___
Python tracker 

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



[issue30747] _Py_atomic_* not actually atomic on Windows with MSVC

2017-06-25 Thread Pär Björklund

Pär Björklund added the comment:

Antoine said it best.

It's very hard to prove that this code is correct or incorrect as it requires 
multiple threads accessing the same variable and very specific timings to 
produce an actual issue.

My PR only solved half of the issue because I didn't really have a good idea 
for how to handle the load macro but I think it out today so I'll be updating 
the PR.

Would there be any interest of implementing them for MSVC/ARM as well? It's 
basically the same code so not much work, however I don't have a platform to 
actually test it.

--

___
Python tracker 

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



[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-25 Thread Stefan Behnel

Stefan Behnel added the comment:

Can the PR be applied then? It looks good to me.

--

___
Python tracker 

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



[issue30752] Basic subtraction is wrong ( 1.83 - 1.52 == 0.31000000000000005)

2017-06-25 Thread Mark Dickinson

Mark Dickinson added the comment:

This is working as expected. Python's floats use the hardware-provided _binary_ 
floating-point format, which can't represent every finite decimal value 
exactly. I recommend reading 
https://docs.python.org/3.6/tutorial/floatingpoint.html for more information.

--
nosy: +mark.dickinson
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



[issue30752] Basic subtraction is wrong ( 1.83 - 1.52 == 0.31000000000000005)

2017-06-25 Thread René Podlogar

New submission from René Podlogar:

My Python-Installations Python 2.7.12, Python 3.4.5 @linux64
and the CLI on the python.org-Website (interactive shell) affected:

Python 3.6.0 (default, Jan 13 2017, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1.83 - 1.52
0.31005
>>> 

Expected= 0.31

Verified in irc-channel #python.de

--
messages: 296817
nosy: René Podlogar
priority: normal
severity: normal
status: open
title: Basic subtraction is wrong ( 1.83 - 1.52 == 0.31005)
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue30696] infinite loop in PyRun_InteractiveLoopFlags()

2017-06-25 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
pull_requests:  -2416

___
Python tracker 

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



[issue30695] add a nomemory_allocator to the _testcapi module

2017-06-25 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
pull_requests:  -2415

___
Python tracker 

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



[issue30747] _Py_atomic_* not actually atomic on Windows with MSVC

2017-06-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The general issue those macros want to prevent is that modern CPUs have a 
tendency to execute a lot of stuff out-of-order, *including* memory operations. 
 From the perspective of a single hardware core (or thread, really), that's 
fine since it  has a logically consistent view of the machine's state (it knows 
which operations have been reordered, which values have been committed to cache 
or not, etc.).  But what happens when another hardware core examines in-memory 
state at the same time? It might find values changing in a different order than 
the programmer had intended. If it's important that the visible order hasn't 
been changed, you have a bug.

Note that C "volatile" is not enough: it only prevents the *compiler* from 
re-ordering or eliding memory accesses, but not the CPU.  As such, "volatile" 
is only useful if you have a single word-sized piece of state that you need to 
inspect from several threads at once.  But the eval loop uses several of them, 
and therefore needs to prevent the CPU from writing or reading them in the 
wrong order (which may produce synchronization bugs such as deadlocks).

Also note that traditionally, x86 has a "strong" memory ordering model which 
prevents nasty kinds of reorderings to happen.  But other architectures such as 
ARM or SPARC can have much weaker memory models (IIRC, we had sporadic hangs on 
an ARM buildbot a long time ago, because of that, but I can't find a reference).

I admit I'm unable to vouch that the current code is correct.  Jeffrey Yasskin 
did the original change adding the Py_atomic types and using them in the GIL 
implementation.

--
nosy: +jyasskin, pitrou

___
Python tracker 

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



Re: os.walk the apostrophe and unicode

2017-06-25 Thread Peter Otten
Steve D'Aprano wrote:

> On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:

>> if everything worked correctly? Though I don't understand why the OP
>> doesn't see
>> 
>> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>> 
>> which is the repr() that I get.
> 
> That's mojibake and is always wrong :-) 

Yes, that's my very point. 

> I'm not sure how you got that.

I took the OP's string at face value and pasted it into the interpreter:

# python 3.4
>>> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'
'06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'

> Something to do with an accidental decode to Latin-1?

If the above filename is the only one or one of a few that seem broken, and 
other non-ascii filenames look OK the OP's toolchain/filesystem may work 
correctly and the odd name might have been produced elsewhere, e. g. by 
copying an already messed-up freedb.org entry.

[Heureka]

However, the most likely explanation is that the filename is correct and 
that the OP is not using Python 3 as he claims but Python 2.

Yes, it took that long for me to realise ;) Python 2 is slowly sinking into 
oblivion...

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


Re: Checking for an exception

2017-06-25 Thread Paul Rubin
Steve D'Aprano  writes:
> What's the right/best way to test whether an object is an exception
> ahead of time? (That is, without trying to raise from it.)

Maybe I'm missing something but 
   isinstance(obj, Exception)
seems to work.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: os.walk the apostrophe and unicode

2017-06-25 Thread Steve D'Aprano
On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:

> Steve D'Aprano wrote:
> 
>> On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
>> 
>>> Then I'd fix the name manually...
>> 
>> The file name isn't broken.
>> 
>> 
>> What's broken is parts of the OP's code which assumes that non-ASCII file
>> names are broken...
> 
> Hm, the OP says
> 
> '06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'
> 
> Shouldn't it be
> 
> '06 - Todd’s Song (Post-Spiderland Song in Progress).flac'

It should, if the OP did everything right.

He has a file name containing the word "Todd’s":

# Python 3.5

py> fname = 'Todd’s'
py> repr(fname)
"'Todd’s'"

On disk, that is represented in UTF-8:

py> repr(fname.encode('utf-8'))
"b'Todd\\xe2\\x80\\x99s'"

The OP appears to be using Python 2, so when he calls os.listdir() he gets the
file names as bytes, not Unicode. That means he'll see:

- the file name will be Python 2 str, which is *byte string* not text string;
- so not Unicode
- rather the individual bytes in the UTF-8 encoding of the file name.

So in Python 2.7 instead of 3.5 above:

py> fname = u'Todd’s'
py> repr(fname)
"u'Todd\\u2019s'"
py> repr(fname.encode('utf-8'))
"'Todd\\xe2\\x80\\x99s'"


> if everything worked correctly? Though I don't understand why the OP doesn't
> see
> 
> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
> 
> which is the repr() that I get.

That's mojibake and is always wrong :-) I'm not sure how you got that. Something
to do with an accidental decode to Latin-1?

# Python 2.7
py> repr(fname.encode('utf-8').decode('latin-1'))
"u'Todd\\xe2\\x80\\x99s'"

# Python 3.5
py> repr(fname.encode('utf-8').decode('latin-1'))
"'Toddâ\\x80\\x99s'"



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: os.walk the apostrophe and unicode

2017-06-25 Thread Peter Otten
Steve D'Aprano wrote:

> On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
> 
>> Then I'd fix the name manually...
> 
> The file name isn't broken.
> 
> 
> What's broken is parts of the OP's code which assumes that non-ASCII file
> names are broken...

Hm, the OP says

'06 - Todd\xe2\x80\x99s Song (Post-Spiderland Song in Progress).flac'

Shouldn't it be

'06 - Todd’s Song (Post-Spiderland Song in Progress).flac'

if everything worked correctly? Though I don't understand why the OP doesn't 
see

'06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'

which is the repr() that I get.

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


[issue4926] putenv() accepts names containing '=', return value of unsetenv() not checked

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The part of this issue ('=' in putenv()) is fixed in issue30746.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30746] Reject environment variable names containing '='

2017-06-25 Thread Serhiy Storchaka

Changes 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



[issue30746] Reject environment variable names containing '='

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 787826c9316b03ac8a197078ec1cdf98fa840c5c by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-30746: Prohibited the '=' character in environment variable names 
(GH-2382) (#2393)
https://github.com/python/cpython/commit/787826c9316b03ac8a197078ec1cdf98fa840c5c


--

___
Python tracker 

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



[issue30746] Reject environment variable names containing '='

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 99e9eb6111ef6a11bfff358866c9f2b0c201ac08 by Serhiy Storchaka in 
branch '3.5':
[3.5] bpo-30746: Prohibited the '=' character in environment variable names 
(GH-2382) (#2392)
https://github.com/python/cpython/commit/99e9eb6111ef6a11bfff358866c9f2b0c201ac08


--

___
Python tracker 

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



[issue30746] Reject environment variable names containing '='

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 9c2dc0c58a878ac3d1c44dd0048f8e1cfab2790e by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-30746: Prohibited the '=' character in environment variable names 
(GH-2382) (#2391)
https://github.com/python/cpython/commit/9c2dc0c58a878ac3d1c44dd0048f8e1cfab2790e


--

___
Python tracker 

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



[issue30746] Reject environment variable names containing '='

2017-06-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset af5392f5c6f8014659e995840df6ee7b5017f743 by Serhiy Storchaka in 
branch 'master':
bpo-30746: Port more tests for os.spawnvpe() and os.execve() from 2.7. (#2394)
https://github.com/python/cpython/commit/af5392f5c6f8014659e995840df6ee7b5017f743


--

___
Python tracker 

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



[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-25 Thread Nathaniel Smith

Nathaniel Smith added the comment:

Interesting idea! I'm not sure I fully understand how it would work though.

What would you do for the frames that don't use the fast array, and where 
locals() currently returns the "real" namespace?

How are you imagining that the trace function writeback would be implemented? 
Some sort of thread-local flag saying "we're inside a trace function for frame 
XX" that causes locals() and f_locals to switch to returning a "real" namespace 
object?

--

___
Python tracker 

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



[issue30422] Add roadmap.txt section to idlelib

2017-06-25 Thread 18z

18z added the comment:

I strongly agree with the idea of writing documents that describe a bit of 
history to help orient new contributors to IDLE as to where the involved 
contributors see it going.

As a new comer, before I started to trace the codes of idlelib. A question 
bothers me all the time. "Why do we need idlelib since there are so many 
brilliant IDEs out there?" And I'm not sure whether should I keep reading the 
codes or not.

So, I want to say Thank you to Terry. Your draft helped me. 

I'm really happy to see this question had been discussed in summer 2010. And 
the result is to modernize idlelib. 

However, I have a suggestion :)

Although the result of the discussion is to modernize. I suggest to add few 
lines to describe the reasons why this decision had been made. And references 
(if possible) are needed to provide since some readers might want to see the 
original discussion.

How do you think? :)

--
nosy: +KunYu Chen

___
Python tracker 

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



Re: Checking for an exception

2017-06-25 Thread Cameron Simpson

On 25Jun2017 13:47, Ben Finney  wrote:

Steve D'Aprano  writes:

[…] the result of passing a non-exception to raise is to raise an
exception, so I cannot trivially distinguish between "caller passes an
exception" and "caller passes a non-exception" (result is still an
exception).


Yes, hence my characterising this problem as the caller's problem.

I'd say: document the expectation that the value will be an exception,
use it based on that specification, and let the caller deal with the
consequences of violating that expectation.


I'm a "fail early" kind of guy, and to me Steve's approach is in the same 
spirit as raising ValueError when a function is handed invalid arguments.


Particularly if the mistake is easy to make, having one's attention brought to 
it immediately (at "declaration" time, since Steve's example is a decorator), 
seems very desirable.


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


[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-25 Thread Nick Coghlan

Nick Coghlan added the comment:

To make the behaviour more consistent in 3.7, I'd be more inclined to go in the 
other direction: make locals() return a truly independent snapshot when used in 
a function, rather than sharing a single snapshot between all locals() calls.

Shared snapshots that may potentially be written back to the frame locals would 
then be unique to trace functions, rather than being a feature of function 
level locals() calls in general.

--

___
Python tracker 

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



[issue30647] CODESET error on AMD64 FreeBSD 10.x Shared 3.x caused by the PEP 538

2017-06-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Current status of the PR:

- testing suggests that "nl_langinfo(CODESET)" fails with LC_CTYPE=UTF-8 on Mac 
OS X as well, but that doesn't matter for Python start-up, since we hardcode 
UTF-8 as the locale encoding and never call nl_langinfo
- on Linux however, "nl_langingo(CODESET)" succeeds as expected

Accordingly, I've revised the tests as follows:

- on Linux and Mac OS X, having setlocale() succeed gets a locale added to the 
"available target locales" set for the tests. This reflects the fact that we 
skip the nl_langinfo(CODESET) check on Mac OS X, and expect it to always 
succeed on Linux if setlocale() succeeds
- on other platforms where "locale.nl_langinfo(locale.CODESET)" is supported, 
we only consider a locale an available target locale if that call returns a 
non-empty answer

At the locale coercion level, I've added an extra check where we save the 
initial locale (i.e. before we change anything), and if setlocale() succeeds, 
but nl_langinfo(CODESET) fails, we do setlocale(LC_CTYPE, initial_locale) to 
try to get things back to their original state.

This seems to *mostly* work on FreeBSD, but doesn't quite get readline back to 
where it is by default, so test_non_ascii in test_readline fails with the error:

```
==
FAIL: test_nonascii (test.test_readline.TestReadline)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/custom.koobs-freebsd10/build/Lib/test/test_readline.py",
 line 203, in test_nonascii
self.assertIn(b"text 't\\xeb'\r\n", output)
AssertionError: b"text 't\\xeb'\r\n" not found in 
bytearray(b"^A^B^B^B^B^B^B^B\t\tx\t\r\n[\\357nserted]|t\x07\x08\x08\x08\x08\x08\x08\x08\x07\x07xrted]|t\x08\x08\x08\x08\x08\x08\x08\x07\r\nresult
 \'[\\udcefnsexrted]|t\'\r\nhistory \'[\\xefnsexrted]|t\'\r\n")

```

My two current guesses as to what may be going wrong there are:

* doing the equivalent of "setlocale(LC_CTYPE, setlocale(LC_CTYPE, NULL))" may 
be taking libc out of the weird initial state where it claims to be using 
ASCII, but is really using latin-1; or
* setting "surrogateescape" on "stdin" is causing some unexpected behaviour in 
the affected test case

I'm leaning towards the former, as if it was the latter, I'd expect to have 
already seen the same error *without* locale coercion.

--

___
Python tracker 

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



[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-25 Thread Nathaniel Smith

Nathaniel Smith added the comment:

It isn't obvious to me whether the write-through proxy idea is a good one on 
net, but here's the rationale for why it might be.

Currently, the user-visible semantics of locals() and f_locals are a bit 
complicated. AFAIK they aren't documented anywhere outside the CPython and PyPy 
source (PyPy is careful to match all these details), but let me take a stab at 
it:

The mapping object you get from locals()/f_locals represents the relevant 
frame's local namespace. For many frames (e.g. module level, class level, 
anything at the REPL), it literally *is* the local namespace: changes made by 
executing bytecode are immediately represented in it, and changes made to it 
are immediately visible to executing bytecode. Except, for function frames, it 
acts more like a snapshot copy of the local namespace: it shows you the 
namespace at the moment you call locals(), but then future changes to either 
the code's namespace or the object don't affect each other. Except except, the 
snapshot might be automatically updated later to incorporate namespace changes, 
e.g. if I do 'ns = locals()' and then later on someone accesses the frame's 
f_locals attribute, then reading that attribute will cause my 'ns' object to be 
silently updated. But it's still a snapshot; modifications to the mapping 
aren't visible to the executing frame. Except**3, if you happen to modify the 
mapping object while you're inside a trace function callback, then *those* 
modifications are visible to the executing frame. (And also if a function is 
being traced then as a side-effect this means that now our 'ns' object above 
does stay constantly up to date.) Except**4, you don't actually have to be 
inside a trace function callback for your modifications to be visible to the 
executing frame – all that's necessary is that *some* thread somewhere is 
currently inside a trace callback (even if it doesn't modify or even look at 
the locals itself, as e.g. coverage.py doesn't).

This causes a lot of confusion [1].

On top of that, we have this bug here. The writeback-only-if-changed idea would 
make it so that we at least correctly implement the semantics I described in 
the long paragraph above. But I wonder if maybe we should consider this an 
opportunity to fix the underlying problem, which is that allowing skew between 
locals() and the actual execution namespace is this ongoing factory for bugs 
and despair. Specifically, I'm wondering if we could make the semantics be:

"locals() and f_locals return a dict-like object representing the local 
namespace of the given frame. Modifying this object and modifying the 
corresponding local variables are equivalent operations in all cases."

(So I guess this would mean a proxy object that on reads checks the fast array 
first and then falls back to the dict, and on writes updates the fast array as 
well as the dict.)

> you can still have race conditions between "read-update-writeback" operations 
> that affect the cells directly, as well as with those that use the new 
> write-through proxy.

Sure, but that's just a standard concurrent access problem, no different from 
any other case where you have two different threads trying to mutate the same 
local variable or dictionary key at the same time. Everyone who uses threads 
knows that if you want to do that then you need a mutex, and if you don't use 
proper locking then it's widely understood how to recognize and debug the 
resulting failure modes. OTOH, the current situation where modifications to the 
locals object sometimes affect the namespace, and sometimes not, and sometimes 
they get overwritten, and sometimes they don't, and it sometimes depends on 
spooky unrelated things like "is some other thread currently being traced"? 
That's *way* more confusing that figuring out that there might be a race 
condition between 'x = 1' and 'locals()["x"] = 2'.

Plus, pdb depends on write-through working, and there are lots of frames that 
don't even use the fast array and already have my proposed semantics. So 
realistically our choices are either "consistently write-through" or 
"inconsistently write-through".

[1] https://www.google.com/search?q=python+modify+locals=utf-8=utf-8

--

___
Python tracker 

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



[issue30450] Pull Windows dependencies from GitHub rather than svn.python.org

2017-06-25 Thread Ammar Askar

Ammar Askar added the comment:

Looks like that error is coming from the fact that the Powershell on that 
buildbot is outdated. As the documentation notes:

https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/invoke-webrequest

> This cmdlet was introduced in Windows PowerShell 3.0.


Before running the web request command maybe do a `powershell.exe -Command 
$PSVersionTable.PSVersion` in order to debug this issue on any other machines?

--
nosy: +ammar2

___
Python tracker 

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