[issue36144] Dictionary addition.

2019-02-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> * It is natural to expect the plus operator to be commutative, but this 
> operation would necessarily be non-commutative.

In Python, the plus operator for sequences (strings, lists, tuples) is 
non-commutative.

But I have other arguments against it:

* It conflicts with the plus operator of Counter (which is a specialized dict): 
Counter(a=2) + Counter(a=3) == Counter(a=5), but the proposed idea makes 
dict(a=2) + dict(a=3) == dict(a=3).

* We already have a syntax for dict merging: {**d1, **d2}. It works with 
arbitrary mappings, in contrary to the plus operator, which needs a special 
support in argument types.

--

___
Python tracker 

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



Re: Quirk difference between classes and functions

2019-02-27 Thread Peter J. Holzer
On 2019-02-27 12:34:37 -0500, Dennis Lee Bieber wrote:
> On Tue, 26 Feb 2019 19:15:16 -0800 (PST), jf...@ms4.hinet.net declaimed the
> following:
> 
> >So, may I say that the Python compiler is a multi-pass one?
> 
>   No... that is implementation dependent...

True, but

>   The common Python is a byte-code compiler pass (how many is undefined)
> which then feeds a byte-code INTERPRETER.

He's only talking about the byte-code compiler here, not the
interpreter.

> The compiler pass "sees" the local assignment, and creates a run-time
> data structure for the function which "holds" the local data.

Yup, but in

def foo():
print(bar)
bar = 1

the compiler sees the local assignment AFTER the print() call. So it
can't generate code to access the local variable for the print call
because it doesn't yet know that bar is a local variable.

The obvious way around this is a two pass compiler: In the first pass
you parse the whole function and convert it into an AST. While you do
this you can also collect local variables. In the second pass you
convert the AST to byte-code.

I think it should be possible to do it in a single pass, although at the
cost of generating less efficient code: For each variable access,
produce code to check for a local variable first, then a global one.
Collect information on local variables at the same time. When you are
done, generate the code to set up the local variables and arrange for it
to be executed before any other code in the function.

hp


-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36144] Dictionary addition.

2019-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For the record, I'm opposed to the idea.

* Use of the + operator is a temptation to produce new dictionaries rather than 
update an existing dict in-place which is usually what you want.

* We already have ChainMap() which presents a single view of multiple mappings 
with any copying.

* It is natural to expect the plus operator to be commutative, but this 
operation would necessarily be non-commutative.

* Many other APIs are modeled on the dict API, so we should not grow the API 
unless there is a big win.  The effects would be pervasive.

* I don't see other languages going down this path, nor am I seeing dict 
subclasses that implement this functionality.  Those are indications that this 
more of a "fun thing we could do" rather than a "thing that people need".

* The existing code already reads nicely:

 options.update(user_selections)

  That reads more like self explanatory English than:

 options += user_selections

  The latter takes more effort to correctly parse and
  makes it less clear that you're working with dicts.

* It isn't self-evident that the right operand needs to be another dictionary. 
If a person is trying to "add a key / value pair" to an existing dictionary, 
the "+=" operator would be tempting but it wouldn't work.

--

___
Python tracker 

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



[issue36144] Dictionary addition.

2019-02-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I believe it was proposed and rejected multiple times.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-27 Thread Peter L


Peter L  added the comment:

+1 for python -v listing .pth files found and loaded.

For debugging, I just add a:
import sys; print('Loading mypth.pth')
to the start of the pth file.
A plain print doesn't work(?).
breakpoint() doesn't work(?).
It would be nice to be able to get the filename (__file__ is site.py)

--

___
Python tracker 

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



[issue36144] Dictionary addition.

2019-02-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Python ideas discussion in 2015 : 
https://mail.python.org/pipermail/python-ideas/2015-February/031748.html
LWN summary : https://lwn.net/Articles/635397/

--
nosy: +xtreak

___
Python tracker 

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



[issue33085] *** Error in `python': double free or corruption (out): 0x00007ff5254d50d0 ***

2019-02-27 Thread chenkai


chenkai <13016135...@163.com> added the comment:

OS:
(python36) [root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 
UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Python 3.6.5 (default, Feb 28 2019, 01:43:16) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
*** Error in `python': free(): invalid pointer: 0x7f4eb7a64558 ***
=== Backtrace: =
/lib64/libc.so.6(+0x81499)[0x7f4eb6c45499]
python(PyOS_Readline+0xec)[0x5cc48c]
python[0x447250]
python[0x448b98]
python(PyTokenizer_Get+0x9)[0x4499d9]
python[0x4457dd]
python(PyParser_ASTFromFileObject+0x89)[0x427909]
python[0x427b1b]
python(PyRun_InteractiveLoopFlags+0x76)[0x427e46]
python(PyRun_AnyFileExFlags+0x3c)[0x427fcc]
python(Py_Main+0xc44)[0x43b934]
python(main+0x162)[0x41d8b2]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f4eb6be6445]
python[0x41d970]
=== Memory map: 

--

___
Python tracker 

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



Re: Lifetime of a local reference

2019-02-27 Thread Alan Bawden
Gregory Ewing  writes:

> Alan Bawden wrote:
> > the Java Language
> > Specification contains the following language:
> >Optimizing transformations of a program can be designed that reduce
> >the number of objects that are reachable to be less than those which
> >would naively be considered reachable.  For example, a Java compiler
> >or code generator may choose to set a variable or parameter that
> >will no longer be used to null to cause the storage for such an
> >object to be potentially reclaimable sooner.
> 
> However, it only makes sense to do that if the compiler can be
> sure that reclaiming the object can't possibly have any side
> effects. That's certainly not true of things like file objects
> that reference resources outside of the program. I'd be pretty
> upset if a Java implementation prematurely closed my files on
> the basis of this clause.

The Java compiler has no way to know whether a variable references an
object with a finalize() method that has side effects, so that quote from
the Specification licenses a Java implementation to do exactly the thing
you say will make you upset.

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


[issue33944] Deprecate and remove pth files

2019-02-27 Thread Peter L


Change by Peter L :


--
nosy: +Peter L3

___
Python tracker 

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



[issue36137] SSL verification fails for some sites inside windows docker container

2019-02-27 Thread Mika Fischer


Mika Fischer  added the comment:

The easiest workaround I found (on Windows 10) is to use
```
certutil -generateSSTFromWU roots.sst && certutil -addstore -f root roots.sst 
&& del roots.sst
```
before using Python...

--

___
Python tracker 

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



[issue13850] Summary tables for argparse add_argument options

2019-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I like the idea of having various summary tables for argparse, but the one in 
the PR isn't visually attractive or self-explanatory.

--

___
Python tracker 

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



[issue36137] SSL verification fails for some sites inside windows docker container

2019-02-27 Thread Mika Fischer


Mika Fischer  added the comment:

> This is probably a duplicate of #36137.

I think you mixed up the issue number, #36137 is this issue.

> Windows doesn't have CA certs pre-installed. They are downloaded from the 
> update server on demand. Python doesn't trigger the update but only uses 
> certs that are already present. It's a design flaw in my implementation. I 
> wasn't aware of Windows' behavior when I hooked up the Windows cert store to 
> the SSL module.

Oh, so that means that it is broken on normal Windows as well and only works 
coincidentally?

In any case, I can confirm that when the certificate is fetched using some 
other means, the request works:
```
docker run -ti python:3.7-windowsservercore-1809 powershell -command 
"(New-Object System.Net.WebClient).DownloadString(\"https://google.com\;) 
>$null; python -c \"import urllib.request as r; 
r.urlopen('https://google.com').close()\""
```

--

___
Python tracker 

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



[issue36144] Dictionary addition.

2019-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I believe that Guido rejected this when it was proposed a few years ago.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue36131] test.test_urllib2net.TimeoutTest ftp related tests fail due to ftp://www.pythontest.net/ being unavailable

2019-02-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

That was my impression.

--

___
Python tracker 

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



Re: Lifetime of a local reference

2019-02-27 Thread Gregory Ewing

Thomas Jollans wrote:

If the inspect module's stack frame inspection machinery is supported,
then any function call might access any local... (though I don't think a
compliant Python implementation necessarily has to support the inspect
module fully).


You can be devious even without using the expect module:

def fun():
f = open("lock.txt", "w")
do_stuff(innocent_argument)

do_stuff = exec
innocent_argument = "f.write('foo')"

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


[issue30235] Validate shutil supports path-like objects, update docs accordingly

2019-02-27 Thread Thrlwiti


Change by Thrlwiti :


--
nosy: +THRlWiTi

___
Python tracker 

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



Re: Lifetime of a local reference

2019-02-27 Thread Gregory Ewing

Alan Bawden wrote:

the Java Language
Specification contains the following language:

   Optimizing transformations of a program can be designed that reduce the
   number of objects that are reachable to be less than those which would
   naively be considered reachable.  For example, a Java compiler or code
   generator may choose to set a variable or parameter that will no longer be
   used to null to cause the storage for such an object to be potentially
   reclaimable sooner.


However, it only makes sense to do that if the compiler can be
sure that reclaiming the object can't possibly have any side
effects. That's certainly not true of things like file objects
that reference resources outside of the program. I'd be pretty
upset if a Java implementation prematurely closed my files on
the basis of this clause.

Similar considerations apply to Python. Even more so, because
its dynamic nature makes it next to impossible for the compiler
to prove much of anything about side effects. So I wouldn't
expect a Python implementation to even try to drop any
references early. If it does, I would hope it darn well knows
what it's doing.

Summary: You don't have to worry about it.

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


[issue36131] test.test_urllib2net.TimeoutTest ftp related tests fail due to ftp://www.pythontest.net/ being unavailable

2019-02-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Just curious if it was some regression or infrastructure related issue in 
pythontest.net ?

--

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Yury Selivanov


Yury Selivanov  added the comment:

> And the same tokenizer trick that detects 'async def' could detect 'async 
> for' easily.

Exactly.  I just never thought that we could support async generator 
expressions with the kind of hacks in tokenizer we had in 3.5-3.6.  FWIW I 
still believe that it's better for async & await tokens to be proper keywords, 
but in case we ever realize we want them to become "soft" keywords we 
apparently have options.

--

___
Python tracker 

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



[issue36144] Dictionary addition.

2019-02-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue36143] Auto-generate Lib/keyword.py

2019-02-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue36143] Auto-generate Lib/keyword.py

2019-02-27 Thread Zachary Ware


Zachary Ware  added the comment:

Lib/keyword.py already regenerates itself from Python/graminit.c when run as a 
script, but there should be a `regen-keyword.py` target added to 
Makefile.pre.in and included as a dependency of the `regen-all` target.  Agreed 
that this is a good starting issue, particularly for anyone wanting to get more 
familiar with Makefiles.

See also issue30638.

--
keywords: +easy
nosy: +zach.ware

___
Python tracker 

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



[issue36144] Dictionary addition.

2019-02-27 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
Python tracker 

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



[issue36144] Dictionary addition.

2019-02-27 Thread Brandt Bucher


New submission from Brandt Bucher :

...as discussed in python-ideas. Semantically:

d1 + d2 <-> d3 = d1.copy(); d3.update(d2); d3
d1 += d2 <-> d1.update(d2)

Attached is a working implementation with new/fixed tests for consideration. 
I've also updated collections.UserDict with the new __add__/__radd__/__iadd__ 
methods.

--
components: Interpreter Core
messages: 336798
nosy: brandtbucher
priority: normal
severity: normal
status: open
title: Dictionary addition.
type: enhancement
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



[issue36143] Auto-generate Lib/keyword.py

2019-02-27 Thread Arfrever Frehtes Taifersar Arahesis


Change by Arfrever Frehtes Taifersar Arahesis :


--
title: AUto-generate Lib/keyword.py -> Auto-generate Lib/keyword.py

___
Python tracker 

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



[issue36143] AUto-generate Lib/keyword.py

2019-02-27 Thread Guido van Rossum


New submission from Guido van Rossum :

The stdib keyword.py module must be regenerated after adding/removing keywords 
from the grammar. While this is rare, we now generate everything else derived 
from the grammar. Hopefully someone can add some rules to the Makefile to 
auto-generate this one too when regen-grammar is run.

This is probably an easy project for a beginning contributor.

--
components: Build
messages: 336797
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: AUto-generate Lib/keyword.py
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



[issue24740] make patchcheck doesn't detect changes if commit is done first

2019-02-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am pretty sure I have done the same after making all commits to the local 
branch.  Plus we have the better workflow.  So closing until there is a 
confirmed problem with the new workflow.

--
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

And the same tokenizer trick that detects 'async def' could detect 'async for' 
easily. See 
https://github.com/python/cpython/pull/12086/files#diff-30b8266a4285de981f8b1b82a8cc6231R1418

--

___
Python tracker 

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



[issue36046] support dropping privileges when running subprocesses

2019-02-27 Thread Patrick McLean


Patrick McLean  added the comment:

I have updated the pull request to include 'group' and 'extra_groups' as 
separate parameters.

--

___
Python tracker 

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



Re: Quirk difference between classes and functions

2019-02-27 Thread jfong
jf...@ms4.hinet.net於 2019年2月26日星期二 UTC+8下午4時46分04秒寫道:
> ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道:
> > Hello
> > 
> > I noticed a quirk difference between classes and functions
> > 
> >  >>> x=0
> >  >>>
> >  >>> class Test:
> >  x = x+1
> >  print(x)
> >  x = x+1
> >  print(x)
> > 
> > 1
> > 2
> >  >>> print(x)
> > 0
> > 
> > Previous code doesn't generate any errors.
> > x at the right of = in first "x = x+1" line is
> > the global one (x=0), then x becomes local
> > 
> > within a function, this is not allowed
> > 
> >  >>> x = 0
> >  >>>
> >  >>> def f():
> >  x = x+1
> > 
> >  >>> f()
> > UnboundLocalError: local variable 'x' referenced before assignment
> > 
> > Since x is written inside the function, it is considered as a local
> > variable and x in x+1 is undefined so this throw an exception
> > 
> > Any comment ?
> 
> May I say that the LEGB rule apply to run time, not compile time?

No. The LEGB apply to compile time where only name and scope are involved.

> 
> >>> x = 1
> >>> def f():
> ... print(x)
> ... print(locals())
> ...
> >>> f()
> 1
> {}
> >>> def g():
> ... print(x)
> ... x = 2
> ... print(locals())
> ...
> >>> g()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "", line 2, in g
> UnboundLocalError: local variable 'x' referenced before assignment
> >>> class X:
> ... print(x)
> ... x = 2
> ...
> 1
> >>>
> The print(x) difference between class and function was caused by that one was 
> executed and the other was compiled. The LEGB rule must apply to run time to 
> make the language dynamic.

At run time, the binding between name and object can be changed. It's the word 
"dynamic" comes from. 

What happens in class X when print(x) was encountered? I have no idea how the 
LEGB involves there yet:-(

--Jach

> 
> Any comment:-)?
> 
> --Jach

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


[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2019-02-27 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-36142: "Add a new _PyPreConfig step to Python initialization to 
setup memory allocator and encodings".

--

___
Python tracker 

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



[issue36142] Add a new _PyPreConfig step to Python initialization to setup memory allocator and encodings

2019-02-27 Thread STINNER Victor


STINNER Victor  added the comment:

PR 12087 is a WIP change which implements everything as a single commit.

I'm not 100% sure yet that it's best approach for Python initialization, but 
I'm sure that it solves real interdependencies issues between _PyCoreConfig 
parameters. IHMO have a "pre-initialization" step to setup the memory allocator 
and the encodings is a better design.

--

___
Python tracker 

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



[issue36142] Add a new _PyPreConfig step to Python initialization to setup memory allocator and encodings

2019-02-27 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue36142] Add a new _PyPreConfig step to Python initialization to setup memory allocator and encodings

2019-02-27 Thread STINNER Victor


New submission from STINNER Victor :

I added a _PyCoreConfig structure to Python 3.7 which contains almost all 
parameters used to configure Python. Problems: _PyCoreConfig uses bytes and 
Unicode strings (char* and wchar_t*) whereas it is also used to setup the 
memory allocator and (filesystem, locale and stdio) encodings.

I propose to add a new _PyPreConfig which is the "strict minimum" configuration 
to setup encodings and the memory allocator. In practice, it also contains 
parameters which directly or indirectly impacts the allocator and encodings. 
For example, isolated impacts use_environment which impacts the allocator 
(PYTHONMALLOC environment variable). Another example: dev_mode=1 sets the 
allocator to "debug".

The command line arguments are now parsed twice. _PyPreConfig only parses a few 
parameters like -E, -I and -X. A temporary _PyPreCmdline is used to store 
command line arguments like -X options.

I moved structures closer to where they are used. "Global" _PyMain structure 
has been removed. _PyCmdline now lives way shorter than previously and is moved 
from main.c to coreconfig.c. The idea is to better control when and how memory 
is allocated.

In term of API, we get something like:

_PyCoreConfig config = _PyCoreConfig_INIT;
config.preconfig.stdio_encoding = "iso8859-1";
config.preconfig.stdio_errors = "replace";
config.user_site_directory = 0;
...

_PyInitError err = _Py_InitializeFromConfig();
if (_Py_INIT_FAILED(err)) {
_Py_ExitInitError(err);
}
...
Py_Finalize();
return 0;

"config.preconfig.stdio_errors" syntax isn't great, but it's simpler to 
implement than duplicating all _PyPreConfig fields into _PyCoreConfig.

--
components: Interpreter Core
messages: 336791
nosy: vstinner
priority: normal
severity: normal
status: open
title: Add a new _PyPreConfig step to Python initialization to setup memory 
allocator and encodings
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



[issue27640] add the '--disable-test-suite' option to configure

2019-02-27 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Yury Selivanov


Yury Selivanov  added the comment:

> But why would we? I already have a working solution. 

I've heard some complaints that it's hard to migrate to Python 3.7 because 
async and await are keywords (although I think by now all popular libraries 
have migrated already), so in case you ever considered to revert that decision 
I think we could actually make it work.  But for the current PR you're working 
on we don't need that, you're right.

--

___
Python tracker 

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



[issue34095] [2.7] Seg fault on archlinux 32 when run tests with xvfb-run

2019-02-27 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue23794] http package should support HTTP/2

2019-02-27 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue29397] linux/random.h present but cannot be compiled

2019-02-27 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

But why would we? I already have a working solution. (Literally reverting 
Jelle's PR won't work anyway, because Serhiy changed how regen-token works.)

--

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Yury Selivanov


Yury Selivanov  added the comment:

Actually, I think we could revert to old lexer hacks in 3.8 if we modify them 
to treat 'async for' tocken sequence as one meta-tocken.

--

___
Python tracker 

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



[issue24740] make patchcheck doesn't detect changes if commit is done first

2019-02-27 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

I believe this issue has been resolved under the new Github workflow.  I ran 
`make patchcheck` on a commit that had been pushed and it identified the 
changes.

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch
pull_requests: +12096
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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

That should still work. The strategy is as follows:

- For Python 3.7 or higher, 'async' and 'await' are *always* recognized.

- For Python 3.5 and 3.6, the hacks from the PEP are used.

--

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-02-27 Thread Yury Selivanov


Yury Selivanov  added the comment:

Well, it's not just rolling back async/await from being keywords. Since 3.7 
it's possible to create async generator expressions in non-async functions. 
This wasn't possible to do with old hacks on the lexer. So if you want to 
revert the change you risk losing some functionality we enabled in 3.7

--
nosy: +yselivanov

___
Python tracker 

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



[issue36132] Python cannot access hci_channel field in sockaddr_hci

2019-02-27 Thread Andrew P. Lentvorski, Jr.


Andrew P. Lentvorski, Jr.  added the comment:

It's up to you how you folks want to deal with this, but classifying it as a 
"bug" for those versions in bugfix is likely acceptable.

You already have to call bind with a tuple, so as long as it is *optional* to 
add an extra field to that tuple (and I can't imagine that any fix would not do 
that as it would break existing code), it's not going to break things.

However, since nobody seems to have felt the need to file this, fixing this in 
3.8 is probably just fine.

--

___
Python tracker 

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



Re: Lifetime of a local reference

2019-02-27 Thread Thomas Jollans
On 27/02/2019 22:39, Roel Schroeven wrote:
> Aren't we overthinking this?

No, it's just that nobody had found the evidence you did.

> 
> I think it's pretty clear that a variable is never deleted before it
> goes out of scope. A quick search in the documentation points me to
> (https://docs.python.org/3/reference/datamodel.html#objects-values-and-types):
> 
> 
> "Objects are never explicitly destroyed; however, when they become
> unreachable they may be garbage-collected. An implementation is allowed
> to postpone garbage collection or omit it altogether — it is a matter of
> implementation quality how garbage collection is implemented, *as long
> as no objects are collected that are still reachable*." (emphasis mine)
> 
> In the original example (without del), f is reachable everywhere in the
> function after the initial binding, so it can not be deleted.

Thanks!


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


[issue30406] async and await should be keywords in 3.7

2019-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sadly if I get my way this will all be reverted -- see 
https://bugs.python.org/issue35975.  I'm working on a PR.

--

___
Python tracker 

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



[issue36128] ResourceReader for FileLoader inconsistently handles path separators

2019-02-27 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue36116] test_multiprocessing_spawn fails on AMD64 Windows8 3.x

2019-02-27 Thread Eryk Sun


Eryk Sun  added the comment:

> And depending on the OS, abort() calls (via Py_FatalError) sometimes 
> appear to be segfaults, so it could be any number of issues. 
> (Aside - I'd love to replace the abort() calls with specific exit
> codes for configuration errors - they really mess up the crash data 
> we see on Windows.)

In particular, with the Universal CRT, an unhandled abort() is implemented by a 
__fastfail intrinsic [1] (int 0x29 instruction in x86) with the argument 
FAST_FAIL_FATAL_APP_EXIT (7). 

Prior to Windows 8 this appears as an access violation. In Windows 8+ it's 
implemented as a second-chance STATUS_STACK_BUFFER_OVERRUN (0xC409) 
exception, which is overloaded from its previous use to support failure codes. 
(The old usage appears as the failure code FAST_FAIL_LEGACY_GS_VIOLATION, 
defined to be 0.) It starts as a second-chance exception in order to bypass 
normal exception handling (i.e. SEH, VEH, UnhandledExceptionFilter). The 
second-chance exception event is sent to an attached debugger and/or the 
session server (csrss.exe).

Python's normal signal handling for SIGABRT can't prevent this, since the C 
handler just sets a flag and returns. But enabling faulthandler sets a C signal 
handler that restores the previous handler and calls raise(SIGABRT). The 
default SIGABRT handler for the explicit raise() code path simply calls 
_exit(3). 

Alternatively, we could prevent the __fastfail call via _set_abort_behavior 
[2], if implemented in msvcrt. For example: msvcrt.set_abort_behavior(0, 
msvcrt.CALL_REPORTFAULT).

[1]: https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
[2]: 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-abort-behavior

--
nosy: +eryksun

___
Python tracker 

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



Re: Lifetime of a local reference

2019-02-27 Thread Roel Schroeven

Rhodri James schreef op 27/02/2019 om 15:18:

On 27/02/2019 06:56, Marko Rauhamaa wrote:

Alan Bawden :

But I appreciate that that isn't the true question that you wanted to ask!
You are wondering if a Python implementation is _permitted_ to treat the
code you wrote _as if_ you had written:

 def fun():
 f = open("lock")
 flock.flock(f, fcntl.LOCK_EX)
 del f
 do_stuff()
 sys.exit(0)

which deletes the variable f from the local environment at a point where it
will never be used again.  (Which could cause the lock to be released
before do_stuff is even called.)

This is an interesting question, and one that any garbage collected
language should probably address somehow.


Interesting indeed.  My gut instinct was "Hell, no!", but as Marko
points out C optimisers do exactly that, and I don't find it
particularly surprising in practice.  I don't think that there is
anything in the docs that says a compliant implementation couldn't
delete variables early.  The nearest you get is repeated reminders that
you can't make assumptions about when destructors will be run.

Aren't we overthinking this?

I think it's pretty clear that a variable is never deleted before it 
goes out of scope. A quick search in the documentation points me to 
(https://docs.python.org/3/reference/datamodel.html#objects-values-and-types):


"Objects are never explicitly destroyed; however, when they become 
unreachable they may be garbage-collected. An implementation is allowed 
to postpone garbage collection or omit it altogether — it is a matter of 
implementation quality how garbage collection is implemented, *as long 
as no objects are collected that are still reachable*." (emphasis mine)


In the original example (without del), f is reachable everywhere in the 
function after the initial binding, so it can not be deleted.


Comparisons with C on this point don't seem very relevant: C doesn't 
have destructors or garbage collection. I don't even see what the C 
equivalent for "del f" could be. You could perhaps compare with C++, 
where destructors are also not called before the object goes out of 
scope (a difference is that in C++ the destructor explicitly always is 
called at that moment).


Regards,
Roel

--
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
-- Franklin P. Jones

Roel Schroeven

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


[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

What is the NDK version ?

There is no Android pthread library. It is possible that the failure comes from 
the fact that the first configure test on pthread_create links with pthread and 
that the Android linker fails now instead of ignoring this error as it did 
before.

Can you add "ac_cv_pthread_is_default=yes" to the configure command line in 
order to tell configure that the pthread functions are in the main libc (i.e. 
bionic) to see if this fixes the problem.

--

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2019-02-27 Thread Robert Marshall


Robert Marshall  added the comment:

I have rebased this to recent master hash 53b9e1a1c1 and submitted a pull 
request.

It built in my CI environment, so seems to be OK as far as compiling.

I'll run the test suite against it later this evening when I have time to stand 
up a quick build enviroment with the full dependency list.

--
nosy: +Robert Marshall
pull_requests: +12095
Added file: 
https://bugs.python.org/file48175/0001-Build-or-disable-readline-module-with-Editline.patch

___
Python tracker 

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



[issue25737] array is not a Sequence

2019-02-27 Thread Manuel Cerón

Change by Manuel Cerón :


--
nosy: +ceronman

___
Python tracker 

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



[issue23864] issubclass without registration only works for "one-trick pony" collections ABCs.

2019-02-27 Thread Manuel Cerón

Change by Manuel Cerón :


--
nosy: +ceronman

___
Python tracker 

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



Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dietmar Schwertberger

On 27.02.2019 20:34, Dan Sommers wrote:

What is a "network widget" in this context?  Application
users don't usually interact with "the network" directly,
and networks are usually on the opposite end of applications
from the GUI.  What would your hypothetical network widget
do?  What cross-platform differences would it abstract/hide?
What do your applications do to/with/against "the network"?


Probably an integration of sockets with the main loop to allow for 
asynchroneous communication.
Qt has a socket class that will deliver events when data is received or 
transmitted. It's a long time that I had a look at this, but I think 
it's available from PyQt as well.
Alternatively, I have successfully used Quamash, which is an integration 
of the Qt event loop with asyncio.


For new projects, I would always recommend to use asyncio as this is 
available in the standard library.


For wxPython there is some code to integrate with asyncio, but I have 
never used this myself.


Alternatively, the communication can always be placed into a separate 
thread, posting events to the main application / frontend.


Regards,

Dietmar

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


Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Michael Torrie
On 02/27/2019 10:59 AM, Igor Korot wrote:
> Hopefully with the wxQt having more and more development we might have
> a wxQt/Android port getting attention.

I don't think Qt has any plans to support Android with the traditional
Qt framework.  They've instead focused on their next generation system,
which is QtQuick.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread muhzi


Change by muhzi :


--
type:  -> compile error

___
Python tracker 

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



[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread muhzi


Change by muhzi :


--
components: +Cross-Build
nosy: +Alex.Willmer

___
Python tracker 

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



Re: Dictionary

2019-02-27 Thread Peter Otten
Phu Sam wrote:

> The condition  'if not fibs.get(n):'  will not work because
> n = 0
>   fibs.get(0) is 0 so not 0 is 1
> 
> Here is the modified code that works:
> 
> fibs={0:0,1:1}
> def rfib(n):
>   if n == 0 or n == 1:
>   return fibs[n]
>   else:
> fibs[n]=rfib(n-2)+rfib(n-1)
> return fibs[n]
> 
 rfib(8)
> 21
 fibs
> {0: 0, 1: 1, 2: 1, 3: 2, 4: 3, 5: 5, 6: 8, 7: 13, 8: 21}
> 
> 
> Cheers,

The problem with this implementation is that it recalculates the results for 
n > 1 over and over again. You construct that nice lookup table and then you 
don't use it.

Compare:

$ cat rfib.py
fibs={0:0,1:1}

def rfib(n):
  if n == 0 or n == 1:
  return fibs[n]
  else:
fibs[n]=rfib(n-2)+rfib(n-1)
return fibs[n]

sfibs = {0: 0, 1: 1}

def sfib(n):
try:
return sfibs[n]
except KeyError:
pass
result = sfibs[n] = sfib(n-1) + sfib(n-2)
return result

for i in range(10):
assert rfib(i) == sfib(i)

$ python3 -m timeit -s 'import rfib' 'rfib.rfib(25)'
10 loops, best of 3: 102 msec per loop
$ python3 -m timeit -s 'import rfib' 'rfib.sfib(25)'
100 loops, best of 3: 0.371 usec per loop


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


[issue36141] configure: error: could not find pthreads on your system during cross compilation

2019-02-27 Thread muhzi


New submission from muhzi :

I am facing a problem while trying to compile Python for android armv7a using 
the latest NDK version (clang). The configure script fails to find pthread 
library, which should be bundled in libc. Here is the full configure output:


Building for armv7a-linux-androideabi
configure: loading site script ./config.site
checking build system type... x86_64-pc-linux-gnu
checking host system type... armv7a-unknown-linux-androideabi
checking for python3.7... python3.7
checking for python interpreter for cross build... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for armv7a-linux-androideabi-gcc... armv7a-linux-androideabi16-clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether armv7a-linux-androideabi16-clang accepts -g... yes
checking for armv7a-linux-androideabi16-clang option to accept ISO C89... none 
needed
checking how to run the C preprocessor... armv7a-linux-androideabi16-clang -E
checking for grep that handles long lines and -e... /bin/grep
checking for a sed that does not truncate output... /bin/sed
checking for --with-cxx-main=... no
checking for the platform triplet based on compiler characteristics... none
checking for -Wl,--no-as-needed... yes
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for the Android API level... 16
checking for the Android arm ABI... 7
checking for --with-suffix... 
checking for case-insensitive build directory... no
checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
checking LINKCC... $(PURIFY) $(MAINCC)
checking for GNU ld... yes
checking for --enable-shared... yes
checking for --enable-profiling... no
checking LDLIBRARY... libpython$(LDVERSION).so
checking for armv7a-linux-androideabi-ar... arm-linux-androideabi-ar
checking for armv7a-linux-androideabi-readelf... arm-linux-androideabi-readelf
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for --with-pydebug... no
checking for --with-assertions... no
checking for --enable-optimizations... no
checking for --with-lto... no
checking for -llvm-profdata... no
checking for -Wextra... yes
checking whether armv7a-linux-androideabi16-clang accepts and needs 
-fno-strict-aliasing... no
checking if we can turn off armv7a-linux-androideabi16-clang unused result 
warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang unused parameter 
warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang missing field 
initializers warning... yes
checking if we can turn off armv7a-linux-androideabi16-clang invalid function 
cast warning... no
checking if we can turn on armv7a-linux-androideabi16-clang mixed sign 
comparison warning... yes
checking if we can turn on armv7a-linux-androideabi16-clang unreachable code 
warning... yes
checking if we can turn on armv7a-linux-androideabi16-clang strict-prototypes 
warning... yes
checking if we can make implicit function declaration an error in 
armv7a-linux-androideabi16-clang... yes
checking whether pthreads are available without options... no
checking whether armv7a-linux-androideabi16-clang accepts -Kpthread... no
checking whether armv7a-linux-androideabi16-clang accepts -Kthread... no
checking whether armv7a-linux-androideabi16-clang accepts -pthread... no
checking whether armv7a-linux-androideabi16-clang++ also accepts flags for 
thread support... no
checking for ANSI C header files... (cached) yes
checking asm/types.h usability... yes
checking asm/types.h presence... yes
checking for asm/types.h... yes
checking crypt.h usability... no
checking crypt.h presence... no
checking for crypt.h... no
checking conio.h usability... no
checking conio.h presence... no
checking for conio.h... no
checking direct.h usability... no
checking direct.h presence... no
checking for direct.h... no
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking grp.h usability... yes
checking 

[issue35360] Update SQLite to 3.26 in Windows and macOS installer builds

2019-02-27 Thread Manuel Cerón

Change by Manuel Cerón :


--
nosy: +ceronman

___
Python tracker 

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



[issue36116] test_multiprocessing_spawn fails on AMD64 Windows8 3.x

2019-02-27 Thread Steve Dower


Steve Dower  added the comment:

It's also possible that the child process is causing the segfault because of 
misconfiguration (e.g. broken environment variables).

And depending on the OS, abort() calls (via Py_FatalError) sometimes appear to 
be segfaults, so it could be any number of issues. (Aside - I'd love to replace 
the abort() calls with specific exit codes for configuration errors - they 
really mess up the crash data we see on Windows.)

I'll try some tests locally to see if this is reproducible, but if anyone can 
extract the original stdout/stderr from the buildbot, that would be helpful.

--

___
Python tracker 

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



Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dan Sommers

On 2/27/19 9:37 AM, Dave wrote:


I have two Python 3 (3.6) apps that will get the full GUI treatment very
soon.  I'm in the process of choosing a GUI, and that may be where
you/your book can help.  Seems this is not a trivial effort (wishing
that Python was like VB6 from the 90's).

Anyway, here is what I am looking for - hopefully it helps guide you.




   A network widget may also be good.


What is a "network widget" in this context?  Application
users don't usually interact with "the network" directly,
and networks are usually on the opposite end of applications
from the GUI.  What would your hypothetical network widget
do?  What cross-platform differences would it abstract/hide?
What do your applications do to/with/against "the network"?
--
https://mail.python.org/mailman/listinfo/python-list


[issue36096] IDLE: Refactor class variables to instance variables in colorizer

2019-02-27 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Michael Torrie
On 02/27/2019 11:36 AM, Karsten Hilbert wrote:
> On Wed, Feb 27, 2019 at 10:38:25AM -0500, Dave wrote:
> 
>> * GUI relatively easy to understand and implement.  easyGUI is truly easy in
>> all areas, but fails some of my other requirements.  The QT/PyQT/PySide2
>> situation is a mess - which one to use, why, any implementation differences,
>> etc.
> 
> Python has been made a first-tier supported language in Qt
> just recently if I understood the news correctly. So, PySide2.

Except PySide2 doesn't yet support all of the core Qt class API, such as
QtSerialPort.  Of course there's PySerial in PyPi, but that's not
integrated with the Qt main loop.  So for me it's PyQt, but hoping
PySide2 will catch up eventually.  Other than missing bits, with a small
wrapper module I wrote, it's actually quite trivial to make code that
works without change on PyQt or PySide2.

So it's not the mess that Dave makes it out to be.  Back in PySide days,
I found a couple of occasions where references to C++ objects would be
dropped, causing segfaults.  This was due to an impedance mismatch
between Python and C++ in terms of references and object lifecycles.
Haven't encountered that in PySide2 though.

>> * Performance is very good.  Users hate to wait - for anything!
> 
> That's rarely a concern in chosing a GUI toolkit.

Agreed. Waiting isn't because the UI doesn't have good performance. It's
because you blocked the main loop.  Learn how to work with your UI
framework's event loop and you won't have this problem.
>> * Lots of widgets!  I'll need a spreadsheet-like widget, a form widget to
>> enter information on parts, activities, etc., splash screen that the code
>> can talk to while the app is loading, and the big one - a cross-platform
>> printer widget that works with Windows and Mac/Unix/CUPS.  A network widget
>> may also be good.
> 
> Usable built-in printer support (and "network widget would be
> good") takes wxPython out of the equation.

wxWidgets does seem to have a wide variety of third-party widgets for
doing all kinds of things like Dave wants, but how much of that is
exposed via Python wrappers?

> Karsten
> PS: Myself using wxPython, so no bashing there.

The future of Qt is QtQuick, and the advantage of it is that whatever
fancy visualization widgets come along, they will be exposed to all
language bindings without any special wrappers. The downside for me is
the heavy use of Javascript for UI logic and event handling.

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


Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dietmar Schwertberger

On 27.02.2019 16:10, Dave wrote:
I have two Python 3 (3.6) apps that will get the full GUI treatment 
very soon.  I'm in the process of choosing a GUI, and that may be 
where you/your book can help.  Seems this is not a trivial effort 
(wishing that Python was like VB6 from the 90's).


IMHO what comes closest to VB6 is wxPython with wxGlade. The focus of 
wxGlade is on frames and dialogs with standard widgets, though. Graphics 
and printing is always a bit more effort.


Regards,

Dietmar

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


Re: Python 3 Boto Unable to parse pagination error

2019-02-27 Thread MRAB

On 2019-02-26 20:06, Tim Dunphy wrote:

Hi all,

I'm trying to create a python 3 script that takes a list of AWS instance
IDs. It then prints out some information about the instances and then
terminates them.

I am very new to python, so still working through some basic issues.

This is the error I get when I run the script:

  python3 .\aws_ec2_termiante_instances.py
 Enter an instance ID separated by commas:
i-0463897140af217f8,i-0634fc5fa453462fb
 enter code here
 Deleting Instance IDs:
 i-0463897140af217f8
 i-0634fc5fa453462fb
 Traceback (most recent call last):
   File ".\aws_ec2_termiante_instances.py", line 37, in 
 NextToken='string'
   File
"C:\Users\tdunphy\AppData\Local\Programs\Python\Python37-32\lib\site-packages\botocore\client.py",
line 357, in _api_call
 return self._make_api_call(operation_name, kwargs)
   File
"C:\Users\tdunphy\AppData\Local\Programs\Python\Python37-32\lib\site-packages\botocore\client.py",
line 661, in _make_api_call
 raise error_class(parsed_response, operation_name)
 botocore.exceptions.ClientError: An error occurred
(InvalidParameterValue) when calling the DescribeInstances operation:
Unable to parse pagination token

This is my script that produces the above output:

 from collections import defaultdict
 import boto3
 # Connect to EC2
 ec2 = boto3.client('ec2')

 instance_id_list = input("Enter an instance ID separated by commas: ")
 instance_ids_text = instance_id_list.split(",")


instance_id_list is a string and instance_ids_text is a list of strings, 
so the names are somewhat misleading.



 print("Deleting Instance IDs:")
 for instance_id in instance_ids_text:
 print(instance_id)

 ec2info = defaultdict()
 for instance_id in instance_ids_text:
 instance = ec2.describe_instances(
 Filters=[
 {
 'Name': 'string',
 'Values': [
 'string',
  ]
 },
 ],
 InstanceIds=[
 'instance_id',


Shouldn't this be the actual id, not the string 'instance_id'?


 ],
 MaxResults=123,
 NextToken='string'
 )
 for tag in instance.tags:
 if 'Name'in tag['Key']:
 name = tag['Value']
 # Add instance info to a dictionary
 ec2info[instance.id] = {
 'Name': name,
 'Instance ID': instance.id,
 'Type': instance.instance_type,
 'State': instance.state['Name'],
 'Private IP': instance.private_ip_address,
 'Public IP': instance.public_ip_address,
 'Launch Time': instance.launch_time
 }

 attributes = ['Name', 'Instance ID', 'Type', 'State',
   'Private IP', 'Public IP', 'Launch Time']
 for instance_id, instance in ec2info.items():
 for key in attributes:
 print("{0}: {1}".format(key, instance[key]))
 print("--")
 ec2.instances.filter(InstanceIds=instance.id).stop()
 ec2.instances.filter(InstanceIds=instance.id).terminate()

To recap, what I would like to do is give the script a list of instance
IDs, print out the list of instance IDs, then print some info about those
instances. Then terminate them.

How can I get past this error and produce that result?


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


[issue36096] IDLE: Refactor class variables to instance variables in colorizer

2019-02-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 488aabafe2f1c5db05a6c1a7a8b49d7b89b1f36b by Terry Jan Reedy (Miss 
Islington (bot)) in branch '3.7':
bpo-36096: IDLE: Refactor class variables in colorizer (GH-12002) (GH-12075)
https://github.com/python/cpython/commit/488aabafe2f1c5db05a6c1a7a8b49d7b89b1f36b


--

___
Python tracker 

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



Re: Dictionary

2019-02-27 Thread Phu Sam
The condition  'if not fibs.get(n):'  will not work because
n = 0
  fibs.get(0) is 0 so not 0 is 1

Here is the modified code that works:

fibs={0:0,1:1}
def rfib(n):
  if n == 0 or n == 1:
  return fibs[n]
  else:
fibs[n]=rfib(n-2)+rfib(n-1)
return fibs[n]

>>> rfib(8)
21
>>> fibs
{0: 0, 1: 1, 2: 1, 3: 2, 4: 3, 5: 5, 6: 8, 7: 13, 8: 21}


Cheers,

Phu





On Sun, Feb 24, 2019 at 10:56 AM Himanshu Yadav <
himanshuyadav9630994...@gmail.com> wrote:

> fibs={0:0,1:1}
> def rfib(n):
>   global fibs
>if not fibs.get(n):
> fibs[n]=rfib(n-2)+rfib(n-1)
> return fibs[n]
>
> Why it is gives error??
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36096] IDLE: Refactor class variables to instance variables in colorizer

2019-02-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12094

___
Python tracker 

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



Re: Scraping multiple web pages help

2019-02-27 Thread Phu Sam
You need to obtain a key for API first - from
https://regulationsgov.github.io/developers/

The Regulations.gov API is taking action to conserve system resources.
Beginning immediately, we will limit
access to one account per organization, and require approval for enabling
accounts.* Please contact the *
*Regulations.gov Help Desk, if you would like to request an API key. *
Please provide your name, email  address, organization, and intended use of
the API.

Send email to:
regulati...@erulemakinghelpdesk.com

Good luck,

Phu

On Mon, Feb 18, 2019 at 10:19 AM Drake Gossi  wrote:

> Hello everyone,
>
> For a research project, I need to scrape a lot of comments from
> regulations.gov
>
>
> https://www.regulations.gov/docketBrowser?rpp=25=DESC=commentDueDate=0=PS=ED-2018-OCR-0064
>
> But partly what's throwing me is the url addresses of the comments. They
> aren't consistent. I mean, there's some consistency insofar as the numbers
> that differentiate the pages all begin after that 0064 number in the url
> listed above. But the differnetiating numbers aren't even all the same
> amount of numbers. Some are 4 (say, 4019) whereas others are 5 (say,
> 50343). But I dont think they go over 5. So this is a problem. I dont know
> how to write the code to access the multiple pages.
>
> I should also mention I'm new to programing, so that's also a problem (if
> you cant already tell by the way I'm describing my problem).
>
>
> I should also mention that, I think, there's an API on regulations.gov,
> but
> I'm such a beginner that I dont evem really know where to find it, or even
> what to do with it once I do. That's how helpless am right now.
>
> Any help anyone could offer would be much appreciated.
>
> D
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3 Boto Unable to parse pagination error

2019-02-27 Thread Tim Dunphy
Hi all,

I'm trying to create a python 3 script that takes a list of AWS instance
IDs. It then prints out some information about the instances and then
terminates them.

I am very new to python, so still working through some basic issues.

This is the error I get when I run the script:

 python3 .\aws_ec2_termiante_instances.py
Enter an instance ID separated by commas:
i-0463897140af217f8,i-0634fc5fa453462fb
enter code here
Deleting Instance IDs:
i-0463897140af217f8
i-0634fc5fa453462fb
Traceback (most recent call last):
  File ".\aws_ec2_termiante_instances.py", line 37, in 
NextToken='string'
  File
"C:\Users\tdunphy\AppData\Local\Programs\Python\Python37-32\lib\site-packages\botocore\client.py",
line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
  File
"C:\Users\tdunphy\AppData\Local\Programs\Python\Python37-32\lib\site-packages\botocore\client.py",
line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred
(InvalidParameterValue) when calling the DescribeInstances operation:
Unable to parse pagination token

This is my script that produces the above output:

from collections import defaultdict
import boto3
# Connect to EC2
ec2 = boto3.client('ec2')

instance_id_list = input("Enter an instance ID separated by commas: ")
instance_ids_text = instance_id_list.split(",")
print("Deleting Instance IDs:")
for instance_id in instance_ids_text:
print(instance_id)

ec2info = defaultdict()
for instance_id in instance_ids_text:
instance = ec2.describe_instances(
Filters=[
{
'Name': 'string',
'Values': [
'string',
 ]
},
],
InstanceIds=[
'instance_id',
],
MaxResults=123,
NextToken='string'
)
for tag in instance.tags:
if 'Name'in tag['Key']:
name = tag['Value']
# Add instance info to a dictionary
ec2info[instance.id] = {
'Name': name,
'Instance ID': instance.id,
'Type': instance.instance_type,
'State': instance.state['Name'],
'Private IP': instance.private_ip_address,
'Public IP': instance.public_ip_address,
'Launch Time': instance.launch_time
}

attributes = ['Name', 'Instance ID', 'Type', 'State',
  'Private IP', 'Public IP', 'Launch Time']
for instance_id, instance in ec2info.items():
for key in attributes:
print("{0}: {1}".format(key, instance[key]))
print("--")
ec2.instances.filter(InstanceIds=instance.id).stop()
ec2.instances.filter(InstanceIds=instance.id).terminate()

To recap, what I would like to do is give the script a list of instance
IDs, print out the list of instance IDs, then print some info about those
instances. Then terminate them.

How can I get past this error and produce that result?

Thank you,
Tim

-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36140] An incorrect check in _msi.c's msidb_getsummaryinformation()

2019-02-27 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue36140] An incorrect check in _msi.c's msidb_getsummaryinformation()

2019-02-27 Thread Zackery Spytz


New submission from Zackery Spytz :

msidb_getsummaryinformation() checks the wrong variable after calling 
PyObject_NEW().

--
components: Windows
messages: 336776
nosy: ZackerySpytz, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: An incorrect check in _msi.c's msidb_getsummaryinformation()
type: behavior
versions: Python 2.7, Python 3.7, 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: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Karsten Hilbert
On Wed, Feb 27, 2019 at 10:38:25AM -0500, Dave wrote:

> * GUI relatively easy to understand and implement.  easyGUI is truly easy in
> all areas, but fails some of my other requirements.  The QT/PyQT/PySide2
> situation is a mess - which one to use, why, any implementation differences,
> etc.

Python has been made a first-tier supported language in Qt
just recently if I understood the news correctly. So, PySide2.

> * Performance is very good.  Users hate to wait - for anything!

That's rarely a concern in chosing a GUI toolkit.

> * Lots of widgets!  I'll need a spreadsheet-like widget, a form widget to
> enter information on parts, activities, etc., splash screen that the code
> can talk to while the app is loading, and the big one - a cross-platform
> printer widget that works with Windows and Mac/Unix/CUPS.  A network widget
> may also be good.

Usable built-in printer support (and "network widget would be
good") takes wxPython out of the equation.

Karsten
PS: Myself using wxPython, so no bashing there.
-- 
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36139] release GIL on mmap dealloc

2019-02-27 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +12092
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: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Igor Korot
Hi,
On Wed, Feb 27, 2019 at 10:53 AM Dave  wrote:
>
> On 2/27/19 11:38 AM, Rhodri James wrote:
> > On 27/02/2019 15:37, Dave wrote:
> >> * GUI must support all desktops with a native look and feel.  Kivy
> >> fails this one.  Will have mobile apps later in the year, so it would
> >> be nice if one GUI fits all, but am ok with 2 gui's if needed.
> >
> > This requirement will cause you endless pain, particularly when mobiles
> > enter the picture.  I'm not convinced it's a completely good idea; a
> > sensible UI for a desktop probably won't be sensible for a phone and
> > vice versa
> >
>
> Agreed - that is why I'm open to two GUI kits.

It is not about the toolkit, but more about the design.
If something works properly on the desktop, there is no guarantee it will look
sensible and normal on the mobile device.
Besides UI guidelines for Android/iOS are very different than for the desktop
application.

Hopefully with the wxQt having more and more development we might have
a wxQt/Android port getting attention.

Thank you.

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


[issue36139] release GIL on mmap dealloc

2019-02-27 Thread Davide Rizzo


New submission from Davide Rizzo :

munmap() can take a long time. I think mmap_object_dealloc can trivially 
release the GIL around this operation. Something similar was already mentioned 
in https://bugs.python.org/issue1572968 but a general patch was never provided. 
The dealloc case alone is significant enough to deserve fixing.

--
components: Library (Lib)
messages: 336775
nosy: davide.rizzo
priority: normal
severity: normal
status: open
title: release GIL on mmap dealloc
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



[issue36116] test_multiprocessing_spawn fails on AMD64 Windows8 3.x

2019-02-27 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Adding Łukasz, as I think this is a release blocker (the Windows 8 and 7 
multiprocessing module may be causing segfaults).

--
nosy: +lukasz.langa
priority: normal -> high

___
Python tracker 

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



[issue36131] test.test_urllib2net.TimeoutTest ftp related tests fail due to ftp://www.pythontest.net/ being unavailable

2019-02-27 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Almost all buildbots have failed due to this issue. It seems that is fixed now:

❯ ./python.exe -m test -v test_urllib2net -u all
== CPython 3.8.0a2+ (heads/master:d5a551c269, Feb 27 2019, 09:17:08) [Clang 
10.0.0 (clang-1000.10.44.4)]
== macOS-10.14.3-x86_64-i386-64bit little-endian
== cwd: /Users/pgalindo3/github/cpython/build/test_python_15573
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 2.02 [1/1] test_urllib2net
test_close (test.test_urllib2net.CloseSocketTest) ... ok
test_custom_headers (test.test_urllib2net.OtherNetworkTests) ... ok
test_file (test.test_urllib2net.OtherNetworkTests) ... ok
test_ftp (test.test_urllib2net.OtherNetworkTests) ... ok
test_redirect_url_withfrag (test.test_urllib2net.OtherNetworkTests) ... ok
test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests) ... 
skipped 'XXX: http://www.imdb.com is gone'
test_urlwithfrag (test.test_urllib2net.OtherNetworkTests) ... ok
test_ftp_basic (test.test_urllib2net.TimeoutTest) ... ok
test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_ftp_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_http_basic (test.test_urllib2net.TimeoutTest) ... ok
test_http_default_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_http_no_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_http_timeout (test.test_urllib2net.TimeoutTest) ... ok

--

Ran 15 tests in 9.531s

OK (skipped=1)

== Tests result: SUCCESS ==

1 test OK.

Total duration: 10 sec 17 ms
Tests result: SUCCESS

I am going to re-trigger a build in all affected buildbots.

--

___
Python tracker 

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



[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, the bug is not fixed, and this is not easy issue. You should use 
non-integer Decimals to reproduce it. In 3.8 this emits a deprecation warning:

>>> import datetime
>>> from decimal import Decimal as D
>>> datetime.datetime.utcfromtimestamp(D(1425808327.307651))
:1: DeprecationWarning: an integer is required (got type 
decimal.Decimal).  Implicit conversion to integers using __int__ is deprecated, 
and may be removed in a future version of Python.
datetime.datetime(2015, 3, 8, 9, 52, 7)

--

___
Python tracker 

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



[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Paul Ganssle


Paul Ganssle  added the comment:

Oh actually that's my mistake. I can't reproduce the failure in the constructor 
in the Python version of the module, and also it seems to be fixed in the pure 
Python version as of at least 3.6:

Python 3.6.7 (default, Oct 25 2018, 16:11:17) 
[GCC 8.2.1 20180831] on linux
>>> import sys
>>> sys.modules['_datetime'] = None
>>> from decimal import Decimal as D
>>> from datetime import datetime
>>> datetime.utcfromtimestamp(D(123456.12345))
datetime.datetime(1970, 1, 2, 10, 17, 36, 123450)

But the truncation behavior is still present in the C version as of Python 
3.8.0a1+:

Python 3.8.0a1+ (heads/master:3766f18, Feb 11 2019, 12:52:31) 
[GCC 8.2.1 20181127] on linux
>>> from datetime import datetime
>>> from decimal import Decimal as D
>>> datetime.utcfromtimestamp(D(123456.12345))
datetime.datetime(1970, 1, 2, 10, 17, 36)


I still think we need a test for the constructor behavior, but I'm going to 
remove "easy", since we still need to fix truncation in the C version.

--
keywords:  -easy

___
Python tracker 

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



[issue28441] Change sys.executable to include executable suffix

2019-02-27 Thread Ned Deily


Change by Ned Deily :


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



[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput

2019-02-27 Thread daniel hahler


daniel hahler  added the comment:

I can confirm that this fixes cursor keys not working properly after "debug 
foo()" (recursive debugging) with pdb.

--
nosy: +blueyed
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: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave

On 2/27/19 11:38 AM, Rhodri James wrote:

On 27/02/2019 15:37, Dave wrote:
* GUI must support all desktops with a native look and feel.  Kivy 
fails this one.  Will have mobile apps later in the year, so it would 
be nice if one GUI fits all, but am ok with 2 gui's if needed.


This requirement will cause you endless pain, particularly when mobiles 
enter the picture.  I'm not convinced it's a completely good idea; a 
sensible UI for a desktop probably won't be sensible for a phone and 
vice versa




Agreed - that is why I'm open to two GUI kits.

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


[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Paul Ganssle


Paul Ganssle  added the comment:

I'm not sure if either of these patches got merged, but at some point this was 
fixed:

Python 3.7.2 (default, Feb  9 2019, 13:18:43) 
[GCC 8.2.1 20181127] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> from decimal import Decimal
>>> datetime.utcfromtimestamp(Decimal(123456.0))
datetime.datetime(1970, 1, 2, 10, 17, 36)


I recommend that someone add some regression tests to this, then we can close 
the issue.

I'm also going to mark this as "easy" since adding tests for this particular 
example should be pretty simple.

--
keywords: +easy

___
Python tracker 

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



[issue15237] Add capsule API to _decimal

2019-02-27 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue22194] access to cdecimal / libmpdec API

2019-02-27 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Rhodri James

On 27/02/2019 15:37, Dave wrote:
* GUI must support all desktops with a native look and feel.  Kivy fails 
this one.  Will have mobile apps later in the year, so it would be nice 
if one GUI fits all, but am ok with 2 gui's if needed.


This requirement will cause you endless pain, particularly when mobiles 
enter the picture.  I'm not convinced it's a completely good idea; a 
sensible UI for a desktop probably won't be sensible for a phone and 
vice versa


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


argparse namespace clashes

2019-02-27 Thread Robin Becker
After converting a previously working optparse I found that I should not be using 'args' as a destination as it seemed to break 
django 1.11 management command execution.


I changed both the flag name '--args' to '--task-args' and the destination 
'args' to 'task-args' and that seemed to fix things.

Is there a recommendation anywhere for names and detinations to avoid?
--
Robin Becker

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


[issue36121] csv: Non global alternative to csv.field_size_limit

2019-02-27 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
components: +Library (Lib) -Extension Modules

___
Python tracker 

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



[issue36121] csv: Non global alternative to csv.field_size_limit

2019-02-27 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue36138] Improve documentation about converting datetime.timedelta to scalars

2019-02-27 Thread Fred L. Drake, Jr.


Change by Fred L. Drake, Jr. :


--
nosy: +fdrake

___
Python tracker 

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



Re: Lifetime of a local reference

2019-02-27 Thread Thomas Jollans
On 27/02/2019 16.41, Marko Rauhamaa wrote:
> Rhodri James :
>> The description of the with statement does explicitly say that the
>> context manager's __exit__() method won't be called until the suite
>> has been executed, so the reference to the open file must exist for at
>> least that long.
> 
> Yeah, but the *true* answer, of course, is:
> 
> def fun():
> f = os.open("lock", os.O_RDONLY)
> flock.flock(f, fcntl.LOCK_EX)
> do_stuff()
> sys.exit(0)
>
> Collect that!

No problemo!

try:
fun()
except SystemExit:
print("Oh no you don't!")

Collect this:

def fun():
f = os.open("lock", os.O_RDONLY)
flock.flock(f, fcntl.LOCK_EX)
do_stuff()
os.kill(os.getpid(), 9)


;-)


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


[issue13850] Summary tables for argparse add_argument options

2019-02-27 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

just for 2.7, 3.7 & 3.8 because they are in bugfix mode.

--
versions: +Python 3.7, Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

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



Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave

Sorry about the duplicate messages - bad hair day!

Dave,

On 2/27/19 10:38 AM, Dave wrote:

On 1/14/19 2:08 PM, Mike Driscoll wrote:

Hi,

I just thought I would let you all know that I am working on my 2nd 
wxPython book, "Creating GUI Applications with wxPython". This one 
will be about actually creating small runnable applications instead of 
just recipes like my Cookbook did. I hope to have 8-10 working 
applications included with the book.


You can read more about it here if you are interested: 
https://www.blog.pythonlibrary.org/2019/01/14/creating-gui-applications-with-wxpython-kickstarter/ 



Feel free to ask me questions about it too.

Thanks,
Mike



Mike,

I have two Python 3 (3.6) apps that will get the full GUI treatment very 
soon.  I'm in the process of choosing a GUI, and that may be where 
you/your book can help.  Seems this is not a trivial effort (wishing 
that Python was like VB6 from the 90's).


Anyway, here is what I am looking for - hopefully it helps guide you.

* GUI relatively easy to understand and implement.  easyGUI is truly 
easy in all areas, but fails some of my other requirements.  The 
QT/PyQT/PySide2 situation is a mess - which one to use, why, any 
implementation differences, etc.


* Performance is very good.  Users hate to wait - for anything!

* Lots of widgets!  I'll need a spreadsheet-like widget, a form widget 
to enter information on parts, activities, etc., splash screen that the 
code can talk to while the app is loading, and the big one - a 
cross-platform printer widget that works with Windows and Mac/Unix/CUPS. 
  A network widget may also be good.


* A GUI designer may be good.  Currently there is Glade for GTK, and 
QT-Designer for QT.


* GUI must support all desktops with a native look and feel.  Kivy fails 
this one.  Will have mobile apps later in the year, so it would be nice 
if one GUI fits all, but am ok with 2 gui's if needed.


* A great book taking me from beginner to expert.

Dave,




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


Re: Lifetime of a local reference

2019-02-27 Thread Marko Rauhamaa
Rhodri James :
> On 27/02/2019 06:56, Marko Rauhamaa wrote:
>> Then there's the question of a sufficient way to prevent premature
>> garbage collection:
>>
>>   def fun():
>>   f = open("lock")
>>   flock.flock(f, fcntl.LOCK_EX)
>>   do_stuff()
>>   f.close()
>>   sys.exit(0)
>>
>>   def fun():
>>   f = open("lock")
>>   flock.flock(f, fcntl.LOCK_EX)
>>   do_stuff()
>>   f.close
>>   sys.exit(0)
>>
>>   def fun():
>>   f = open("lock")
>>   flock.flock(f, fcntl.LOCK_EX)
>>   do_stuff()
>>   f
>>   sys.exit(0)
>>
>>   def fun():
>>   f = open("lock")
>>   flock.flock(f, fcntl.LOCK_EX)
>>   do_stuff()
>>   sys.exit(0)
>
> I would go with:
>
> def fun():
> with open("lock") as f:
> flock.flock(f, fcntl.LOCK_EX)
> do_stuff()
> sys.exit(0)
>
> The description of the with statement does explicitly say that the
> context manager's __exit__() method won't be called until the suite
> has been executed, so the reference to the open file must exist for at
> least that long.

Yeah, but the *true* answer, of course, is:

def fun():
f = os.open("lock", os.O_RDONLY)
flock.flock(f, fcntl.LOCK_EX)
do_stuff()
sys.exit(0)

Collect that!

;-)


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


Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dave

On 1/14/19 2:08 PM, Mike Driscoll wrote:

Hi,

I just thought I would let you all know that I am working on my 2nd wxPython book, 
"Creating GUI Applications with wxPython". This one will be about actually 
creating small runnable applications instead of just recipes like my Cookbook did. I hope 
to have 8-10 working applications included with the book.

You can read more about it here if you are interested: 
https://www.blog.pythonlibrary.org/2019/01/14/creating-gui-applications-with-wxpython-kickstarter/

Feel free to ask me questions about it too.

Thanks,
Mike



Mike,

I have two Python 3 (3.6) apps that will get the full GUI treatment very 
soon.  I'm in the process of choosing a GUI, and that may be where 
you/your book can help.  Seems this is not a trivial effort (wishing 
that Python was like VB6 from the 90's).


Anyway, here is what I am looking for - hopefully it helps guide you.

* GUI relatively easy to understand and implement.  easyGUI is truly 
easy in all areas, but fails some of my other requirements.  The 
QT/PyQT/PySide2 situation is a mess - which one to use, why, any 
implementation differences, etc.


* Performance is very good.  Users hate to wait - for anything!

* Lots of widgets!  I'll need a spreadsheet-like widget, a form widget 
to enter information on parts, activities, etc., splash screen that the 
code can talk to while the app is loading, and the big one - a 
cross-platform printer widget that works with Windows and Mac/Unix/CUPS. 
 A network widget may also be good.


* A GUI designer may be good.  Currently there is Glade for GTK, and 
QT-Designer for QT.


* GUI must support all desktops with a native look and feel.  Kivy fails 
this one.  Will have mobile apps later in the year, so it would be nice 
if one GUI fits all, but am ok with 2 gui's if needed.


* A great book taking me from beginner to expert.

Dave,

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


  1   2   >