[issue37757] TargetScopeError not raised for comprehension scope conflict

2019-08-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> We report all sorts of things found by the bytecode compiler as SyntaxError.

Except of these which are reported with IndentationError or its subclass 
TabError.

--

___
Python tracker 

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



[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-08-05 Thread Inada Naoki


Change by Inada Naoki :


--
components: +IO -Extension Modules
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue21261] Teach IDLE to Autocomplete dictionary keys

2019-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for going through the history of this issue.  It was surprisingly 
convoluted.  I still hope this feature comes to fruition.

--

___
Python tracker 

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



[issue37770] implement __reversed__ on reversed types

2019-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Happy to post a pull request if it would be considered.

I don't we should do this.  Mostly, it seems pointless, but it also isn't 
really something we would want people to be doing.

> Should that give [1, 2, 3] or [1, 2, 3, 4]? I think that
> either answer will annoy and surprise some people.

Right.  I don't think we should open this can of worms.

Thank for you the suggestion, but we should decline this one unless a 
compelling use case arises.

--
nosy: +rhettinger
resolution:  -> rejected
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



[issue25172] Unix-only crypt should not be present on Windows.

2019-08-05 Thread Srinivas Nyayapati


Srinivas Nyayapati  added the comment:

Hello
I would like to work on this issue. First time contributor here. Would putting 
the import _crypt statement on line 3 in crypt.py inside a try/except block and 
checking to see if platform is windows then give an appropriate message be a 
good fix?

Thank you
-Srinivas

--
nosy: +shireenrao

___
Python tracker 

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



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Terry, I used a similar patch. My main use case was around typing where 
normal shell autocompletes it and was curious if it was intentional. I didn't 
know that windows didn't give keywords. The keywords are short and added very 
rarely and perhaps the bigger completion list to actual usage might be low 
since no one opened this issue as Tal mentioned I am open to others feedback.

--
nosy: +rhettinger

___
Python tracker 

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



[issue37770] implement __reversed__ on reversed types

2019-08-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Both 3.7 and 3.8 are in feature-freeze, so the earliest we can get this would 
be 3.9.

But before that, we have to decide on what reversing a reversed object means.

it = reversed([1, 2, 3, 4])
next(it)
list( reversed(it) )

Should that give [1, 2, 3] or [1, 2, 3, 4]? I think that either answer will 
annoy and surprise some people.

[1, 2, 3] will surprise those who expect to get the original iterable back. [1, 
2, 3, 4] will surprise those who expect reversed to operate on the current 
state of an iterator, not it's previous state.

--
nosy: +steven.daprano
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue37757] TargetScopeError not raised for comprehension scope conflict

2019-08-05 Thread Guido van Rossum


Guido van Rossum  added the comment:

But we don't do that with any of the other (many) errors detected by later 
passes of the compiler. Those report dozens of SyntaxErrors, with good 
descriptive messages. Users can search the web for those messages too.

Also, I doubt that many people will ever get a TargetScopeError. The examples 
are all esoteric -- yes, the compiler needs to reject them, but no, they are 
not things one is likely to try intentionally. (The exception may be the 
forbidden form you're adding, [... for ... in (i := ...)].)

--

___
Python tracker 

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



[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2019-08-05 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
nosy: +yselivanov

___
Python tracker 

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



[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2019-08-05 Thread GeeVye


New submission from GeeVye :

In PEP 525, async generators were introduced. They use `.asend()` and 
`.athrow()` methods that return a "coroutine-like" object - specifically, a 
PyAsyncGenASend and PyAsyncGenAThrow respectively.

While these "coroutine-like" object implement `.send()`, `.throw()`, and 
`.close()`, they don't provide any attributes like normal coroutine objects do 
such as `cr_running` or `cr_await`.

When I use `inspect.getcoroutinestate()`, it raises an AttributeError on how 
there isn't a `cr_running` attribute / flag.

There is a workaround I use which is to wrap it with another coroutine as below:

>>> async def async_generator():
... yield
...
>>> async def wrap_coro(coro):
... return await coro
>>> agen = async_generator()
>>> asend = wrap_coro(agen.asend(None))

This seems like something that should be changed to make it more inline with 
normal coroutines / awaitables.

--
components: Demos and Tools
messages: 349093
nosy: GeeVye
priority: normal
severity: normal
status: open
title: No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend 
instances
type: behavior
versions: Python 3.8

___
Python tracker 

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



Re: Python/SQLite best practices

2019-08-05 Thread Cameron Simpson

On 06Aug2019 00:01, Jonathan Moules  wrote:
Some gotcha tips from using SQLite with Python that I've encountered.  

[...]
* To be reliably INSERTed Byte data should be first converted to 
sqlite3.Binary(my_data) explicitly


Interesting. Is that Python 2 specific, or also in Python 3. Because the 
latter would surprise me (not saying it isn't the case).


* It's typically opaque as to where the install of SQLite is that the 
library is using and it's very hard and not-documented as to how to 
update the SQLite version that Python is using.


On a UNIX system the command "lsof -p pid-of-running-python-process" 
should show the path of the sqlite library that is linked to the Python 
executable, which should let you learn this.


If you want an even thinner wrapper around SQLite there's APSW ( 
https://rogerbinns.github.io/apsw/index.html ) - I've never used it 
myself but it's useful to know about. There's a page with differences 
- https://rogerbinns.github.io/apsw/pysqlite.html#pysqlitediffs


And for a thicker wrapper, I've been extremely happy using SQLAlchemy 
for database access. It has an expression syntax where real Python 
expressions (containing "column" objects) evaluate to safe SQL, letting 
you write safe queries in nice Pythonic form, and it also has an ORM for 
more sophisticated use. It provided context manager for transactions and 
sessions for various work. Finally, it knows about a lot of backends, so 
you could switch backends later (eg from SQLite to PostgreSQL) if that 
becomes a thing.


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


[issue37757] TargetScopeError not raised for comprehension scope conflict

2019-08-05 Thread Nick Coghlan


Nick Coghlan  added the comment:

I believe our main motivation for separating it out was the fact that even 
though TargetScopeError is a compile-time error, the affected code is 
syntactically fine - there are just issues with unambiguously inferring the 
intended read/write location for the affected target names. (Subclassing 
SyntaxError is then a pragmatic concession to the fact that "SyntaxError" also 
de facto means "CompilationError")

Searching for "Python TargetScopeError" will also get folks to relevant 
information far more quickly than searching for "Python SyntaxError" will.

Pre-seeding Stack Overflow with an answer to "What does TargetScopeError mean 
in Python?" would probably be a good idea though (similar to what I did for 
https://stackoverflow.com/questions/25445439/what-does-syntaxerror-missing-parentheses-in-call-to-print-mean-in-python
 )

--

___
Python tracker 

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



[issue21261] Teach IDLE to Autocomplete dictionary keys

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The history is confusing. bpo user Louie Lu (louielu), as github user 'noname 
louisom', open PR 1511 for this existing issue on 2017 May 9.  On May 12, he 
opened #30348 and PR 1512 with the tests for fetch_completions and get_entity 
that were part of PR 1511.  (This was a needed separation.)

By June, he had switched to a new github name 'Louie Lu mlouielu'.  On June 12, 
he opened #30632 and PR 2124, which duplicated #30348 and PR 1512 (which partly 
duplicated PR 1511).  On June 15, he closed PR 1511 to 'migrate' it to pr 2209. 
 But the latter only included the tests also in PR 1512, which it replaced on 
#30348, and PR 2124.  He also closed #1512.  Loiue moved on to other projects 
in Fall, 2017.

After revisions, I merged PR 2209 for #30348 last March.  I followed up with 
#36419, PR 15121, now merged. I just opened #37766 to finish preparing 
autocomplete for new additions such as this.  I was thinking of this issue when 
I included adding an htest.  (Note: #27609 is the master issue for completions.)

Notes for migrating the dict keys code:
1. In PR 15121, I shrank mode names to ATTRS and FILES.  The new mode name 
should be KEYS, or maybe SKEYS (for string keys).  Other refactors should not 
affect KEYS too much.
2. I intend to change 'smalll' and 'bigl' to 'small' and 'big' and might make 
other changes to fetch_completions.
3. I intend to split test_fetch_completions into separate methods for each 
mode. The new KEYS tests should be a separate method 'test_fetch_keys'.

The questions of function calls in the entity expression is more nuanced than I 
know when I wrote msg293520.  For force-open-completions, control-space, 
function calls are allowed.  But I do not think that this affects the new mode.

--
assignee:  -> terry.reedy

___
Python tracker 

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



[issue37741] importlib.metadata docs not showing up in the module index

2019-08-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> Why is the code in `Lib/importlib/metadata/__init__.py`

Mainly because originally, the code was in multiple modules. I'm happy for it 
to move into a single file module.

--

___
Python tracker 

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



Re: Python/SQLite best practices

2019-08-05 Thread Jonathan Moules
Some gotcha tips from using SQLite with Python that I've encountered. 
You may already know some/all of these:


* SQLite doesn't have a "Truncate" function - simply delete the file if 
possible for larger datasets.
* Explicitly committing is good because the default python sqlite3 
library does it randomly and implicitly. I found that doing it only when 
the database is dettaching or closing speeds things up a lot.
* SQLite 3 only considers up to 64bits an INTEGER. So if you want to 
insert a 128bit string you have to use Python string substitution (i.e. 
"Hello %s") rather than the SQLite variable substitution "insert into 
tab values (?)"
* To be reliably INSERTed Byte data should be first converted to 
sqlite3.Binary(my_data) explicitly
* By default Foreign Keys are not enforced. Enable them at connection 
time if you care about referential integrity!
* It's typically opaque as to where the install of SQLite is that the 
library is using and it's very hard and not-documented as to how to 
update the SQLite version that Python is using.


If you want an even thinner wrapper around SQLite there's APSW ( 
https://rogerbinns.github.io/apsw/index.html ) - I've never used it 
myself but it's useful to know about. There's a page with differences - 
https://rogerbinns.github.io/apsw/pysqlite.html#pysqlitediffs



On 2019-08-05 22:43, David Raymond wrote:

"What's the advantage of this over letting the connection object do
that for you? As the context manager exits, it will automatically
either commit or roll back. If you want to guarantee closing _as
well_, then you can do that, but you can at least use what already
exists."

After review I guess I should have phrased it more as a "here's what I've found for 
reference" rather than a "here's what _you_ should do"


Part of it is large use of the Command Line Interface for SQLite, and similar 
command line tools for other db's, which all work in autocommit mode by 
default, so that's how my brain is now wired to think about executing things.

The context manager transaction feature I can see using, and might actually 
start switching to it as it's explicit enough. Though oddly, __enter__ doesn't 
seem to actually begin a transaction, not even a deferred one. It's only 
__exit__ that either commits or rolls back.
(Eh, it'd "probably" be simple enough to subclass Connection so that __enter__ 
and __exit__ work properly no matter the isolation_level. Famous last words)

The implicit stuff I hated because it never seemed straightforward enough. Especially since there used to be 
implicit commits as well as implicit begins ("Changed in version 3.6: sqlite3 used to implicitly commit 
an open transaction before DDL statements. This is no longer the case.") Maybe because I was new to both 
Python and SQLite at the time, but there was a lot of "stop doing hidden stuff I didn't tell you 
do" getting muttered, along with others like "why do I need to commit when I never did a 
begin?" The documentation on it is all of 1 sentence, so there was a lot of trial an error going on.
"The Python sqlite3 module by default issues a BEGIN statement implicitly before a 
Data Modification Language (DML) statement (i.e. INSERT/UPDATE/DELETE/REPLACE)."


"(Also, I'd definitely use conn.commit() rather than
cur.execute("commit"), in case there's extra functionality in the
commit method.)"

True. I know for example that if you try to rollback when not in a transaction that 
cur.execute("rollback;") will raise an exception whereas conn.rollback() will 
quietly suppress it for you. So there might be similarly useful stuff in .commit()
sqlite3 is (almost) all C though, so there'd be noticeably more digging and 
decyphering required to check. (For me anyway)



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


[issue2889] curses for windows (alternative patch)

2019-08-05 Thread Ulf Magnusson


Ulf Magnusson  added the comment:

Just as an FYI, there is a repository for building curses wheels for Windows at 
https://github.com/zephyrproject-rtos/windows-curses, based on patches from 
here and Gohlke's work.

Building wheels is less straightforward than it used to be, e.g. due to term.h 
disappearing from PDCurses.

We also make wheels available on PyPI.

--
nosy: +ulfalizer

___
Python tracker 

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



[issue37770] implement __reversed__ on reversed types

2019-08-05 Thread Jason Curtis


Change by Jason Curtis :


--
title: reversed class should implement __reversed__ -> implement __reversed__ 
on reversed types

___
Python tracker 

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



[issue37770] reversed class should implement __reversed__

2019-08-05 Thread Jason Curtis


Jason Curtis  added the comment:

Ok, not so sure about the PR now; I dug around and realized this is a C 
implementation and my C is likely not strong enough!

--

___
Python tracker 

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



[issue37769] Windows Store installer should warn user about MAX_PATH

2019-08-05 Thread Eryk Sun


Eryk Sun  added the comment:

> I think this only happens with open(). 

Well, and everything else that calls a CRT function and relies on errno, such 
as C read() and write(). Though we'd have to look through on a case-by-case 
basis to ensure that _doserrno is valid in each case, i.e. that errno was set 
based on a Windows error code.

--

___
Python tracker 

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



[issue37769] Windows Store installer should warn user about MAX_PATH

2019-08-05 Thread Eryk Sun


Eryk Sun  added the comment:

> First it seems the error is being raised incorrectly - winerror 2 is 
> for file not found, but it's being passed as errno 2. 

I think this only happens with open(). The _io module could use the CRT's 
_doserrno value to call PyErr_SetExcFromWindowsErrWithFilenameObject. We can 
rely on _doserrno if _wopen fails.

Otherwise this is the expected mapping from Windows ERROR_PATH_NOT_FOUND (3) or 
ERROR_FILENAME_EXCED_RANGE (206) to POSIX ENOENT (2). The Windows error in the 
case of path that's too long is not ERROR_FILE_NOT_FOUND (2).

--
nosy: +eryksun

___
Python tracker 

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



Re: Please help me

2019-08-05 Thread MRAB

On 2019-08-05 17:40, arash kohansal wrote:

Hello ive just installed python on my pc and ive already check the path
choice part but microsoft visual code can not find it and it does not have
the reload item


1. Open Visual Studio Code.

2. Press F1, type "Python: Select Interpreter", and then press Enter.

3. Select the Python version that you installed from the list.
--
https://mail.python.org/mailman/listinfo/python-list


[issue37770] reversed class should implement __reversed__

2019-08-05 Thread Jason Curtis


New submission from Jason Curtis :

I've just been trying to implement some logic which potentially involves 
reversing things back to their initial orders, and it'd be nice to just be able 
to call reversed() on something that has already been reversed.

>>> reversed(reversed([1,2,3,4]))
TypeError: 'list_reverseiterator' object is not reversible

Seems like this should be trivial to implement by just returning the initial 
iterator.

Happy to post a pull request if it would be considered.

--
components: Library (Lib)
messages: 349085
nosy: jason.curtis
priority: normal
severity: normal
status: open
title: reversed class should implement __reversed__
type: enhancement
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



[issue37757] TargetScopeError not raised for comprehension scope conflict

2019-08-05 Thread Guido van Rossum


Guido van Rossum  added the comment:

[Barry]
> I know the PEP defines TargetScopeError as a subclass of SyntaxError, but it 
> doesn't really explain why a subclass is necessary.  I think seeing 
> "TargetScopeError" will be a head scratcher.  Why not just SyntaxError 
> without introducing a new exception?

Hm, that's not a bad point. We report all sorts of things found by the bytecode 
compiler as SyntaxError.

OTOH This would require a PEP change, formal review, etc. (IMO much more so 
than adding the new edge case that Nick and Damien discovered.) Maybe the best 
way of doing this would be to implement TargetScopeError now, then start the 
debate about killing it, and try to get that in before beta4?

--

___
Python tracker 

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



[issue37769] Windows Store installer should warn user about MAX_PATH

2019-08-05 Thread Steve Dower


Steve Dower  added the comment:

Short of adding a popup into Python itself the first time you run it (and would 
that include if you run "pip" first?), we don't have any ability to extend the 
installer.

We could reduce the "local-packages/Python37/site-packages" part of the path by 
implementing an alternative way (in both Python and pip, presumably) to specify 
the user's site packages. Right now, the best I can do is reduce 
"local-packages" down to a single character (in PC/python_uwp.cpp ) - the rest 
is forcibly added by the shared part of the runtime.

Since pip is likely to be the first place users hit this, it might be easiest 
to start by adding a more descriptive error message. Copying from the other bug:

pip3 install 
https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl
fails with an error message:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such 
file or directory: 
'C:\\Users\\[username]\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python37\\site-packages\\caffe2\\python\\serialized_test\\data\\operator_test\\collect_and_distribute_fpn_rpn_proposals_op_test.test_collect_and_dist.zip'

First it seems the error is being raised incorrectly - winerror 2 is for file 
not found, but it's being passed as errno 2. But otherwise it should be 
possible to detect this case, see that the path is too long on Windows and 
point users at 
https://docs.python.org/3/using/windows.html#removing-the-max-path-limitation

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

___
Python tracker 

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



[issue37759] Polish whatsnew for 3.8

2019-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 26f91db5ba487033994b396011518cfc80bf8401 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-37759:  First round of major edits to Whatsnew 3.8 (GH-15127) (GH-15139)
https://github.com/python/cpython/commit/26f91db5ba487033994b396011518cfc80bf8401


--

___
Python tracker 

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



[issue37415] Error build Python with Intel compiler: doesn't provide atomic_uintptr_t

2019-08-05 Thread Christian Berger


Christian Berger  added the comment:

I have the same problem on RH6 with icc 2019.4 and Python 3.6.9. Do you want a 
new bug for that?
Changing Include/pyatomic.h to use _Atomic as suggested by Victor in msg346785 
leads to the error that _Atomic was undefined.

--
nosy: +cberger

___
Python tracker 

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



[issue37706] IDLE: fix sidebar click-drag bug and macOS test failures

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I remembered this morning that we need to check test_tkk_guionly or (easier, 
but less obviously also all gui) test_tk either in test suite output, or run by 
itself with
  python -m test.test_tk  # or test -ugui test_tk
because idle it has non-gui tests that always run. From a random Azure Mac 
output:
  test_ttk_guionly skipped -- cannot run without OS X gui process
whereas Azure Ubuntu gives
  [201/419] test_ttk_guionly passed
and ditto for test_tk.  Also, "test_tix test_tk test_ttk_guionly" under 'tests 
skipped'.

The skips for the only current Mac buildbot I found,
https://buildbot.python.org/all/#/workers/20,
Matt Billenstein  High Sierra 10.13.6,
also include "test_tix test_tk test_ttk_guionly"

Perhaps you can ask him if his machine is suitable for adding gui tests and 
offer to help.

Tal, when you can build on Mac, are you making framework builds?  Does test_tk 
run?

--

___
Python tracker 

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



[issue37769] Windows Store installer should warn user about MAX_PATH

2019-08-05 Thread Jonas Binding


New submission from Jonas Binding :

The "Windows Store" installer for Python has a seemingly low entry barrier, 
causing people to install without reading something like 
https://docs.python.org/3.7/using/windows.html. 

However, due to the really long path it uses for Python (e.g. 
C:\Users\USERNAME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\),
 the chances of running into issues with paths longer than 260 characters are 
really high. 

For example installing pytorch already fails due to this limitation, see 
https://github.com/pytorch/pytorch/issues/23823 and 
https://www.reddit.com/r/pytorch/comments/c6cllq/issue_installing_pytorch/

Therefore, the Windows Store installer should offer to change the registry key 
to enable longer paths, or at least show a message to this effect.

--
components: Windows
messages: 349079
nosy: Jonas Binding, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows Store installer should warn user about MAX_PATH
type: enhancement
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: Python/SQLite best practices

2019-08-05 Thread Chris Angelico
On Tue, Aug 6, 2019 at 7:45 AM David Raymond  wrote:
> The context manager transaction feature I can see using, and might actually 
> start switching to it as it's explicit enough. Though oddly, __enter__ 
> doesn't seem to actually begin a transaction, not even a deferred one. It's 
> only __exit__ that either commits or rolls back.
> (Eh, it'd "probably" be simple enough to subclass Connection so that 
> __enter__ and __exit__ work properly no matter the isolation_level. Famous 
> last words)
>

Easier just to leave the isolation level and let it automatically
begin. (This is another reason to use the commit and rollback methods,
as they may flag the connection as "hey, remember to begin before the
next query".)

> The implicit stuff I hated because it never seemed straightforward enough. 
> Especially since there used to be implicit commits as well as implicit begins 
> ("Changed in version 3.6: sqlite3 used to implicitly commit an open 
> transaction before DDL statements. This is no longer the case.") Maybe 
> because I was new to both Python and SQLite at the time, but there was a lot 
> of "stop doing hidden stuff I didn't tell you do" getting muttered, along 
> with others like "why do I need to commit when I never did a begin?" The 
> documentation on it is all of 1 sentence, so there was a lot of trial an 
> error going on.
>

I grew up on DB2 5.0 (after working in PC File and dbase), and you
never did a BEGIN TRANSACTION unless you wanted to set specific
parameters, but always had to COMMIT/ROLLBACK. The database itself
would automatically open a transaction as soon as you do any query,
and leave it open till you're done. So to me, that was never a
problem.

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


RE: Python/SQLite best practices

2019-08-05 Thread David Raymond
"What's the advantage of this over letting the connection object do
that for you? As the context manager exits, it will automatically
either commit or roll back. If you want to guarantee closing _as
well_, then you can do that, but you can at least use what already
exists."

After review I guess I should have phrased it more as a "here's what I've found 
for reference" rather than a "here's what _you_ should do"


Part of it is large use of the Command Line Interface for SQLite, and similar 
command line tools for other db's, which all work in autocommit mode by 
default, so that's how my brain is now wired to think about executing things.

The context manager transaction feature I can see using, and might actually 
start switching to it as it's explicit enough. Though oddly, __enter__ doesn't 
seem to actually begin a transaction, not even a deferred one. It's only 
__exit__ that either commits or rolls back.
(Eh, it'd "probably" be simple enough to subclass Connection so that __enter__ 
and __exit__ work properly no matter the isolation_level. Famous last words)

The implicit stuff I hated because it never seemed straightforward enough. 
Especially since there used to be implicit commits as well as implicit begins 
("Changed in version 3.6: sqlite3 used to implicitly commit an open transaction 
before DDL statements. This is no longer the case.") Maybe because I was new to 
both Python and SQLite at the time, but there was a lot of "stop doing hidden 
stuff I didn't tell you do" getting muttered, along with others like "why do I 
need to commit when I never did a begin?" The documentation on it is all of 1 
sentence, so there was a lot of trial an error going on.
"The Python sqlite3 module by default issues a BEGIN statement implicitly 
before a Data Modification Language (DML) statement (i.e. 
INSERT/UPDATE/DELETE/REPLACE)."


"(Also, I'd definitely use conn.commit() rather than
cur.execute("commit"), in case there's extra functionality in the
commit method.)"

True. I know for example that if you try to rollback when not in a transaction 
that cur.execute("rollback;") will raise an exception whereas conn.rollback() 
will quietly suppress it for you. So there might be similarly useful stuff in 
.commit()
sqlite3 is (almost) all C though, so there'd be noticeably more digging and 
decyphering required to check. (For me anyway)

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


ANN: poliastro 0.13.0 released 

2019-08-05 Thread Juan Luis Cano Rodríguez
Hi all,

It fills us with astronomical joy to announce the release of poliastro
0.13.0! 

poliastro is a pure Python library that allows you to simulate and
analyze interplanetary orbits in a Jupyter notebook in an interactive
and easy way, used in academia and the industry by people from all
around the world. You can install it using pip or conda:

conda install poliastro --channel conda-forge
pip install poliastro

This major release is packed with new features, especially the new CZML
exporting capabilities and miscellaneous additions and important fixes
on the algorithmic side. It also sets a new high in terms of
contributors, which makes us extremely proud and thankful!

You can read the full release notes in the documentation:

https://docs.poliastro.space/en/v0.13.0/changelog.html#poliastro-0-13-0-2019-08-05

If you want to know more, don't miss my talk on the Open Source Cubesat
Worshop held at the European Space Operations Centre in 2017:

https://youtu.be/KnoYzqAw_vM?t=1h36m14s

Please join our chat on Matrix/Riot and feel free to ask any questions
you might have:

https://chat.openastronomy.org/#/room/#poliastro:matrix.org

Per Python ad astra!

--
Juan Luis Cano
--
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/

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


[issue21261] Teach IDLE to Autocomplete dictionary keys

2019-08-05 Thread Tal Einat


Tal Einat  added the comment:

I had no idea that this was desired... I had this working in a old version of 
autocomplete back before 2010!  I'm not sure whether I'll be able to find it 
though.

I can't understand why Louie's PR was closed, it seemed to be going in the 
right direction... Any explanation?

--
nosy: +taleinat
versions: +Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread Chris Angelico
On Tue, Aug 6, 2019 at 7:09 AM DL Neil  wrote:
> As a matter of interest (and if you don't mind sharing), which packages
> are included in the organisation's student "stack"?
> (again: no 'judgement', please)

TBH the best stack I can describe is what we teach for JavaScript
students, as they're the ones who have the bootcamp format (although
that's now changing, as we have a data science bootcamp built on
Python - but I don't know whether the tech stack has been settled
yet). We get them to use VS Code, ESLint, Node.js, npm, git,
PostgreSQL (once they get to that point), and a handful of JavaScript
libraries/packages.

> How 'expensive' or distracting is it, merely in terms of trainees
> failing to follow the installation/configuration instructions?

Not too bad; there's some cost when someone has trouble setting up
eslint, or when their editor's indentation settings don't match the
linter's, but it's manageable.

> Do you find 'my first program' (when trainees are first required to use
> the 'stack') to be a major failure/frustration/drop-out point? To what
> degree might that be caused by the trainee realising that (s)he has to
> turn 'book knowledge' into coding-action, ie 'the real world', and how
> much might be the 'cost' of those tools?

No, but I think the level of pressure in a bootcamp tends to lead to
people just blindly accepting what they're given, rather than
objecting to it. "You want me to use VS Code? Okay, no prob, what do I
click on?". There isn't time to debate it, because within the next
three hours, there are about eight hours' worth of work to be done :)
Things would be different in other contexts.

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


[issue37706] IDLE: fix sidebar click-drag bug and macOS test failures

2019-08-05 Thread Ned Deily


Ned Deily  added the comment:

Terry, using an out-of-date version of Tcl/Tk is the least of the problems 
here.  My point was that, the way things are now, IDLE GUI tests are not being 
run at all on macOS Azure CI runs regardless of the Tk version in use and, 
AFAIK, there is no easy way to tell that from the default output from the 
tests.  The particular test failures reported here *do* fail when properly 
configured to actually run using the Apple-supplied Tk 8.5.9 (in fact, with the 
latest fixes to the tests, all of test_idle passes with Tk 8.5.9).  And I'm 
guessing that most times when you or Tal or other developers are running the 
tests from your own local builds, you aren't aware that the GUI tests are being 
skipped.

There is a long-standing issue with Aqua Tk on macOS that, if a process tries 
to call Tk to draw objects on a screen but the process is not running under a 
username that is logged in through the normal macOS GUI (i.e. does not have a 
macOS Finder window, does not have a macOS "console"), Tk will segfault 
crashing Python along with it, which is very bad when running tests.  There 
have been various issues about this going back a long time (see, for example, 
Issue22770 but there are older ones).  To avoid those segfaults, we take a 
conservative approach in test.support._is_gui_available()  
(Lib/test/support/__init__.py) which is effectively (I believe) only allows GUI 
tests on macOS to run if they are being run under an application bundle which 
effectively means the Python under test must be a framework build (./configure 
... --enable-framework=... ...).  I believe that test is overly stringent but 
we haven't up to now found a reliable way to test and prevent the segfaults 
without depen
 ding on the framework approach.

So (1) if you don't build Python with an --enable-framework= option, Tk and 
IDLE GUI tests are not going to be run.

(2) If the GUI tests are skipped, there is no indication of this in the default 
log output.  You only see this if you run, for example, with the regrtest -v 
(verbose) option:

$ ./python.exe -m test -uall -j2 test_idle
Run tests in parallel using 2 child processes
0:00:01 load avg: 2.56 [1/1] test_idle passed

== Tests result: SUCCESS ==

1 test OK.

Total duration: 1 sec 753 ms
Tests result: SUCCESS

$ ./python.exe -m test -v -uall -j2 test_idle
[...]
Run tests in parallel using 2 child processes
0:00:01 load avg: 2.22 [1/1] test_idle passed
skipped 'cannot run without OS X gui process'
skipped 'cannot run without OS X gui process'
skipped 'cannot run without OS X gui process'
test_geticonname (idlelib.idle_test.test_browser.ChildBrowserTreeItemTest) ... 
ok
test_getsublist (idlelib.idle_test.test_browser.ChildBrowserTreeItemTest) ... ok
test_gettext (idlelib.idle_test.test_browser.ChildBrowserTreeItemTest) ... ok
test_init (idlelib.idle_test.test_browser.ChildBrowserTreeItemTest) ... ok
test_isexpandable (idlelib.idle_test.test_browser.ChildBrowserTreeItemTest) ... 
ok
test_ondoubleclick (idlelib.idle_test.test_browser.ChildBrowserTreeItemTest) 
... ok
skipped 'cannot run without OS X gui process'
[...]
skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_textview (unittest.loader.ModuleSkipped) ... skipped 
'cannot run without OS X gui process'
idlelib.idle_test.test_tooltip (unittest.loader.ModuleSkipped) ... skipped 
'cannot run without OS X gui process'
idlelib.idle_test.test_tree (unittest.loader.ModuleSkipped) ... skipped 'cannot 
run without OS X gui process'
idlelib.idle_test.test_undo (unittest.loader.ModuleSkipped) ... skipped 'cannot 
run without OS X gui process'
test_run_show (idlelib.idle_test.test_warning.RunWarnTest) ... ok
test_showwarnings (idlelib.idle_test.test_warning.RunWarnTest) ... ok
test_idle_formatter (idlelib.idle_test.test_warning.ShellWarnTest) ... ok
test_shell_show (idlelib.idle_test.test_warning.ShellWarnTest) ... ok
test_showwarnings (idlelib.idle_test.test_warning.ShellWarnTest) ... ok
skipped 'cannot run without OS X gui process'
test_init (idlelib.idle_test.test_window.WindowListTest) ... ok
skipped 'cannot run without OS X gui process'

--

Ran 257 tests in 1.001s

OK (skipped=70)

== Tests result: SUCCESS ==

1 test OK.

Total duration: 1 sec 836 ms
Tests result: SUCCESS

So there is a false sense of security that tests are being run when they aren't 
and those skipped GUI test might be failing if they were actually run as was 
the case in this issue.

Possible followup actions:

1. Have test_idle (and test_ttk_guionly?) issue a warning message by default if 
GUI tests are being skipped.

2. Investigate if it is practical to run GUI tests under Azure CI (I'm guessing 
it is not) or one of the other CI runners we use (Appveyor maybe?).  (Note I 
personally will not have time to look into this until at least the Sep dev 
sprint so it would be good for someone else to look into it).  That would also 
require 

Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread DL Neil

On 6/08/19 12:04 AM, Chris Angelico wrote:

On Mon, Aug 5, 2019 at 8:54 PM DL Neil  wrote:

On 3/08/19 5:50 PM, Chris Angelico wrote:

On Sat, Aug 3, 2019 at 3:36 PM DL Neil  wrote:

On 3/08/19 4:02 PM, Terry Reedy wrote:

...


Sometimes there can be magical firewall penetration tricks that allow
the traffic to go peer-to-peer after an initial handshake with some
central server, but this has its own problems. On any network that I
control, such tricks are disabled; if you want to listen to
connections from the outside world, you get my explicit permission and
an actual line in the firewall configs.


Here is the point where I'll bow-out. This sort of stuff is what 
NetAdmins are for! Better minds than mine...




Also, there are scenarios when both (of the pair) might be contributing
by 'coding' concurrently, eg one writing tests and the other code, or
one writing one class and the other a second. (but you can debate if
that is "pair-programming")


No, that's not pair programming. That's collaboration on a project,
but it's not the sort of thing where you need to see the other
person's screen.


Agreed. "Pair-programming" seemed the closest, commonly-used, 
professional term to describe how one might be remotely-useful (pun!?) 
during the PUG's Coding Evening.


It seems reasonable that if folk are working-together yet on separate 
components, when they link the two components, both being able to see 
'the same thing' would be a natural approach, eg one writing the tests 
and another the code - what happens when the tests run?


Anyway, this PUG mtg is going to be an 'experience'.
(I'll try (almost) anything once!)


...

Is it acceptable to train folk to code (in a particular language)
without also covering the likely tools they will (also) use?

So with Python, during the first lesson we could jump straight into a
one-line print( "hello world" ) program using the REPL. However, an
editor will be employed as soon as we want our code to persist. So
should we (immediately) promote the use of a professional editor/IDE, eg
PyCharm, Sublime Text, Codium, Eclipse; or a 'traditional' character
editing tool, eg Vi, emacs?
(please no 'religious wars' just because I mentioned both in the same
sentence!)


At my work, we instruct students on how to set up one particular tech
stack, including an editor, linter, source control, etc, etc. We're
clear with them that these are not the only options, but for the sake
of bootcamp time pressures, we aren't going to show them any others.

Depending on what you're trying to do, it MAY be acceptable to teach
just the language. But that won't make someone employable on its own.

Like everything, "it depends" :)


Indeed!

As a matter of interest (and if you don't mind sharing), which packages 
are included in the organisation's student "stack"?

(again: no 'judgement', please)

How 'expensive' or distracting is it, merely in terms of trainees 
failing to follow the installation/configuration instructions?


Do you find 'my first program' (when trainees are first required to use 
the 'stack') to be a major failure/frustration/drop-out point? To what 
degree might that be caused by the trainee realising that (s)he has to 
turn 'book knowledge' into coding-action, ie 'the real world', and how 
much might be the 'cost' of those tools?

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


[issue37768] IDLE: Show help(object) output in a text viewer

2019-08-05 Thread Tal Einat


Tal Einat  added the comment:

Raymond, I'm interested in your opinion on this.

--
nosy: +rhettinger

___
Python tracker 

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



[issue37768] IDLE: Show help(object) output in a text viewer

2019-08-05 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-15140.

--

___
Python tracker 

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



[issue37768] IDLE: Show help(object) output in a text viewer

2019-08-05 Thread Tal Einat


Change by Tal Einat :


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

___
Python tracker 

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



[issue37767] TTK Treeview alternating row color not working

2019-08-05 Thread Zachary Ware


Zachary Ware  added the comment:

That file is part of Tcl/Tk and just bundled with Python on Windows; please 
raise an issue on the Tk issue tracker (which appears to be here: 
https://core.tcl-lang.org/tk/ticket).  If and when the change is released in a 
new version of Tcl/Tk, please feel free to open a new issue here requesting 
that we update to that version.

--
nosy: +zach.ware
resolution:  -> third party
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



[issue37768] IDLE: Show help(object) output in a text viewer

2019-08-05 Thread Tal Einat


New submission from Tal Einat :

Currently, IDLE just writes the entire help message into the shell.

If auto-squeezing is enabled, then long help messages are automatically 
squeezed, following which the help text can be viewed in a text viewer or 
expanded inline.  This is still not great UX.

I propose to simply have help(object) open a text viewer with the help text.  
There's actually an old (2007) comment in Lib\idlelib\pyshell.py by KBK that 
this should be done.

See related discussion in issue #35855.

--
assignee: taleinat
components: IDLE
messages: 349073
nosy: taleinat, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: Show help(object) output in a text viewer
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue35855] IDLE squeezer: improve unsqueezing and autosqueeze default

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I presume you are proposing to wrap the site-added help with a function that 
would check object outputs and put them either in the shell unsqueezed or 
directly into a viewer.  Seems plausible.

--

___
Python tracker 

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



[issue37767] TTK Treeview alternating row color not working

2019-08-05 Thread Christopher Caputo


New submission from Christopher Caputo :

The default installation of Python3.7 on all my Win10 machines has a ttk theme 
file that disables treeview alternating row colors. The specific file for me is 
"vistaTheme.tcl" located at "C:\Program Files\Python37\tcl\tk8.6\ttk". In the 
#Treeview section of the file the "ttk::style map Treeview" line needed to be 
changed from:

ttk::style map Treeview \
-background [list disabled $colors(-frame)\
{!disabled !selected} $colors(-window) \
selected SystemHighlight] \
-foreground [list disabled $colors(-disabledfg) \
{!disabled !selected} black \
selected SystemHighlightText]

Changed to:

ttk::style map Treeview
-background [list selected SystemHighlight]
-foreground [list selected SystemHighlightText]

Essentially all the "disabled" parts needed to be removed.

--
components: Tkinter
messages: 349071
nosy: Mookiefer
priority: normal
severity: normal
status: open
title: TTK Treeview alternating row color not working
type: behavior
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



[no subject]

2019-08-05 Thread arash kohansal
Hello i have a laptob and working with windows 10 ive installed python in
my pc and ive already check the path choice pary in the installation im
working with microsoft visual studio code but it cant find the python
installed extention and it doesnt have the green star on the top of python
language
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27609] IDLE completions: format, factor, and fix

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

#37765 Include keywords in ''(__main__) list.

## Annotate completion list, at least as an option, with 'keyword' or 
class, possibly prefixed with 'built-in', so 'built-in function', 'function', 
and so on.

#37766 revise fetch_completions, add htest

--
dependencies: +IDLE autocomplete: revise fetch_completions, add htest, IDLE: 
Include keywords in __main__ autocomplete list

___
Python tracker 

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



[issue37766] IDLE autocomplete: revise fetch_completions, add htest

2019-08-05 Thread Terry J. Reedy


New submission from Terry J. Reedy :

#36419 did not cover fetch_ completions.  Most of the remaining 7% of 
autocomplete not covered by tests is in that function.  I want to rename smalll 
to small and bigl to big (and in test file); they are awkward to read and 
write.  I may want to revise otherwise to aid testing.

The test line referencing #36405 fails when run in autocomplete itself.  I need 
to refresh myself as to why I added it and revise or delete.

Some of the test_fetch_completion needs revision, and it should be split before 
being augmented.

An htest would make manual testing of intended behavior changes easier.

--
assignee: terry.reedy
components: IDLE
messages: 349069
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE autocomplete: revise fetch_completions, add htest
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue37759] Polish whatsnew for 3.8

2019-08-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14877
pull_request: https://github.com/python/cpython/pull/15139

___
Python tracker 

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



[issue37759] Polish whatsnew for 3.8

2019-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 4f9ffc9d1a6a293563def4a13331302219b4 by Raymond Hettinger in 
branch 'master':
bpo-37759:  First round of major edits to Whatsnew 3.8 (GH-15127)
https://github.com/python/cpython/commit/4f9ffc9d1a6a293563def4a13331302219b4


--

___
Python tracker 

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



Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread DL Neil

On 6/08/19 1:43 AM, Hugh Sasse wrote:
I might not have followed this thread closely enough.  I remembered 
there is a thing called Copilot.

It connects two machines so that two people can work together.
https://www.copilot.com/About

If this is the wrong answer, it may at least help define the negative 
space around what you want.


Thank you Hugh.

Yes, there are a few of these Copilot-style packages. The one that seems 
popular in 'my circle' is called TeamViewer.


We will definitely offer that as an option at Wednesday's PUG mtg, and 
if someone requests Copilot, or similar, I'll try to adapt.


No, not "negative" by any means. Many thanks!

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


[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue37765] IDLE: Include keywords in __main__ autocomplete list

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

If keywords are included when the REPL has tab completions (which Windows 
doesn't), then it is plausible that IDLE should.  It could be considered part 
of 'Shell should (mostly) imitate REPL'.  But I can see Tal's point, though the 
relative expansion is pretty small.  And there is nothing on the master 
completions issue #27609 where I collected known not-yet-rejected suggestions 
and ideas.

The implementation is trivial.  Add two new lines to autocomplete.py.  So you 
can easily patch a private copy.  I am preparing a minimal PR.

import keyword  # add
...
def fetch_completions(self, what, mode):
...
bigl = eval("dir()", namespace)
bigl.extend(keyword.kwlist)  # add
bigl.sort()

True, False, and None are also in builtins, so cannot serve as a test.
---

A separate idea: annotate completion list, at least as an option, with 
'keyword' or class, possibly prefixed with 'built-in', so 'built-in function', 
'function', and so on.

--
nosy:  -rhettinger
stage:  -> test needed
title: Include keywords in autocomplete list for IDLE -> IDLE: Include keywords 
in __main__ autocomplete list
versions: +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



[issue35855] IDLE squeezer: improve unsqueezing and autosqueeze default

2019-08-05 Thread Tal Einat


Tal Einat  added the comment:

Regarding help(), there's actually a comment in IDLE's code by KBK that it 
should be opened in a reader (this was before TextViewer was added).  IMO 
that's a much better approach for long help() outputs, and is simple to 
implement.

--

___
Python tracker 

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



Please help me

2019-08-05 Thread arash kohansal
Hello ive just installed python on my pc and ive already check the path
choice part but microsoft visual code can not find it and it does not have
the reload item
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python/SQLite best practices

2019-08-05 Thread Chris Angelico
On Tue, Aug 6, 2019 at 5:05 AM David Raymond  wrote:
> I believe the default Connection context manager is set up for the context to 
> be a single transaction, with a commit on success or a rollback on a failure. 
> As far as I know it does NOT close the connection on exiting the context 
> manager. That only happens automatically when it's getting garbage 
> collected/going out of scope/correct terminology that I can't seem to 
> remember.
>
>
> For transactions and general use I vastly prefer using "isolation_level = 
> None" when creating my connections, and then explicitly issuing all begin, 
> commit, and rollback commands with cur.execute("begin;"), conn.commit(), 
> conn.rollback() etc.
>
>
> contextlib.closing() can be used to wrap cursors for use with with
> (and also connections if they are created with isolation_level = None)
>
> with contextlib.closing(sqlite3.connect(fi, isolation_level = None)) as conn:
> conn.row_factory = sqlite3.Row
> with contextlib.closing(conn.cursor()) as cur:
> cur.execute("begin;")
> stuff
> conn.commit()
>
>
>
> Normally though my stuff tends to look like the below (for better or for 
> worse):
>
> conn = sqlite3.connect(fi, isolation_level = None)
> try:
> conn.row_factory = sqlite3.Row
> with contextlib.closing(conn.cursor()) as cur:
> cur.execute("standalone query not needing an explicit transaction;")
> stuff
> cur.execute("begin;")
> multiple queries that needed the explicit transaction
> stuff
> cur.execute("commit;")
> except something bad:
> blah
> finally:
> conn.rollback()
> conn.close()
>

What's the advantage of this over letting the connection object do
that for you? As the context manager exits, it will automatically
either commit or roll back. If you want to guarantee closing _as
well_, then you can do that, but you can at least use what already
exists.

(Also, I'd definitely use conn.commit() rather than
cur.execute("commit"), in case there's extra functionality in the
commit method.)

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


RE: Python/SQLite best practices

2019-08-05 Thread David Raymond
Not a full expert, but some notes:


I believe the default Connection context manager is set up for the context to 
be a single transaction, with a commit on success or a rollback on a failure. 
As far as I know it does NOT close the connection on exiting the context 
manager. That only happens automatically when it's getting garbage 
collected/going out of scope/correct terminology that I can't seem to remember.


For transactions and general use I vastly prefer using "isolation_level = None" 
when creating my connections, and then explicitly issuing all begin, commit, 
and rollback commands with cur.execute("begin;"), conn.commit(), 
conn.rollback() etc.


contextlib.closing() can be used to wrap cursors for use with with
(and also connections if they are created with isolation_level = None)

with contextlib.closing(sqlite3.connect(fi, isolation_level = None)) as conn:
conn.row_factory = sqlite3.Row
with contextlib.closing(conn.cursor()) as cur:
cur.execute("begin;")
stuff
conn.commit()



Normally though my stuff tends to look like the below (for better or for worse):

conn = sqlite3.connect(fi, isolation_level = None)
try:
conn.row_factory = sqlite3.Row
with contextlib.closing(conn.cursor()) as cur:
cur.execute("standalone query not needing an explicit transaction;")
stuff
cur.execute("begin;")
multiple queries that needed the explicit transaction
stuff
cur.execute("commit;")
except something bad:
blah
finally:
conn.rollback()
conn.close()



-Original Message-
From: Python-list  On 
Behalf Of Dave via Python-list
Sent: Monday, August 05, 2019 1:49 PM
To: python-list@python.org
Subject: Python/SQLite best practices

I'm looking for some tips from experienced hands on on this subject. 
Some of the areas of interest are (feel free to add more):

* Passing connections and cursors - good, bad indifferent?  I try to 
avoid passing file handles unless necessary, so I view connections and 
cursors the same.  Though that said, I'm not aware of any specific 
problems in doing so.

For designs with multiple tables:
* Better to pass an sql string to functions that create/add 
data/update/delete data and pass them to create, insert, update, delete 
functions; or have those functions for each table?  Taking table 
creation for example, if there are five tables, and the sql string is 
passed, there would need to be six functions to do it, though the 
complexity of each function may be reduced a little.  [table1create with 
sql and establishing a cursor, to table5create and then a function that 
executes the sql].

Best way to establish the connection and cursor, as well as close them? 
I have seen many ways to do this, and know that the with block can be 
used to create a connection and close it automatically, but the same is 
not true of the cursor.  Also, using only a with block does not handle 
any errors as well as a try/with.  For example:

 |   try:
 |  # Use with block to create connection – it will close self.
 |   with sqlite3.connect(path) as conn:
 |   cur = conn.cursor()
 |   cur.execute(sql_ProjectsTable)
 |   cur.close()
 |   except Error as e:
 |   print(e)

What else?

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


[issue37765] Include keywords in autocomplete list for IDLE

2019-08-05 Thread Tal Einat


Tal Einat  added the comment:

To be clear, I'm currently -1 on this suggestion.

--

___
Python tracker 

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



[issue37765] Include keywords in autocomplete list for IDLE

2019-08-05 Thread Tal Einat


Tal Einat  added the comment:

The global completion list (i.e. when not completing a file name or object 
attribute) is already full of all the built-ins, imported modules and 
variables.  So IMO we'd need a good reason to add yet more options into the 
completions list.

Personally, I don't think that adding all of the keywords to that list would be 
helpful: They are all short words and most of them must be memorized anyways to 
work with Python.

For instance, I don't recall this being brought up by those who often teach 
newcomers with IDLE, such as Raymond Hettinger, when discussing what's missing 
in IDLE. I'd be happy to get more input from them on this.

--
nosy: +rhettinger

___
Python tracker 

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



[issue37741] importlib.metadata docs not showing up in the module index

2019-08-05 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

@jaraco - Why is the code in `Lib/importlib/metadata/__init__.py` instead of 
`Lib/importlib/metadata.py`?  Is that to make it easier to port between CPython 
stdlib and the standalone version?

--

___
Python tracker 

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



[issue37741] importlib.metadata docs not showing up in the module index

2019-08-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Including a module directive with synopsis as below in importlib.metadata.rst 
seems to fix this. It would also be good to include a link to source code from 
the importlib.metadata docs page since it's written in Python.

.. module:: importlib.metadata
   :synopsis: The implementation of the importlib metadata.

**Source code:** :source:`Lib/importlib/metadata/__init__.py`

--
nosy: +xtreak

___
Python tracker 

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



Re: Python/SQLite best practices

2019-08-05 Thread Karsten Hilbert
On Mon, Aug 05, 2019 at 08:12:27PM +0200, Karsten Hilbert wrote:

> Transactions involving several commands may require passing
> around of connections and/or cursors, however.

Among chains of python code, that is.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python/SQLite best practices

2019-08-05 Thread Karsten Hilbert
On Mon, Aug 05, 2019 at 01:49:24PM -0400, Dave via Python-list wrote:

> * Passing connections and cursors - good, bad indifferent?  I try to avoid
> passing file handles unless necessary, so I view connections and cursors the
> same.

Connections may be more long-lived, per thread perhaps.

Cursors would generally be throw-away.

Transactions involving several commands may require passing
around of connections and/or cursors, however.


> Best way to establish the connection and cursor, as well as close them? I
> have seen many ways to do this, and know that the with block can be used to
> create a connection and close it automatically, but the same is not true of
> the cursor.  Also, using only a with block does not handle any errors as
> well as a try/with.  For example:
>
> |   try:
> | # Use with block to create connection – it will close self.
> |   with sqlite3.connect(path) as conn:
> |   cur = conn.cursor()
> |   cur.execute(sql_ProjectsTable)
> |   cur.close()
> |   except Error as e:
> |   print(e)

Use of

try:
except:
finally:

may come in handy for clean closure.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37765] Include keywords in autocomplete list for IDLE

2019-08-05 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +taleinat

___
Python tracker 

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



[issue37765] Include keywords in autocomplete list for IDLE

2019-08-05 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Currently, the basic repl for python provides keywords as part of 
autocompletion but IDLE doesn't provide them. I was trying to build an async 
repl on top of IDLE to support top level await statements as part of IDLE since 
"python -m asyncio" doesn't provide a good repl and found during usage keywords 
like async/await being part of autocomplete to provide a good experience like 
the basic repl to type faster. I couldn't find any old issues with search 
around why keywords were excluded so I thought of filing a new one for this 
suggestion.

--
assignee: terry.reedy
components: IDLE
messages: 349061
nosy: terry.reedy, xtreak
priority: normal
severity: normal
status: open
title: Include keywords in autocomplete list for IDLE
type: enhancement
versions: Python 3.9

___
Python tracker 

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



Python/SQLite best practices

2019-08-05 Thread Dave via Python-list
I'm looking for some tips from experienced hands on on this subject. 
Some of the areas of interest are (feel free to add more):


* Passing connections and cursors - good, bad indifferent?  I try to 
avoid passing file handles unless necessary, so I view connections and 
cursors the same.  Though that said, I'm not aware of any specific 
problems in doing so.


For designs with multiple tables:
* Better to pass an sql string to functions that create/add 
data/update/delete data and pass them to create, insert, update, delete 
functions; or have those functions for each table?  Taking table 
creation for example, if there are five tables, and the sql string is 
passed, there would need to be six functions to do it, though the 
complexity of each function may be reduced a little.  [table1create with 
sql and establishing a cursor, to table5create and then a function that 
executes the sql].


Best way to establish the connection and cursor, as well as close them? 
I have seen many ways to do this, and know that the with block can be 
used to create a connection and close it automatically, but the same is 
not true of the cursor.  Also, using only a with block does not handle 
any errors as well as a try/with.  For example:


|   try:
|   # Use with block to create connection – it will close self.
|   with sqlite3.connect(path) as conn:
|   cur = conn.cursor()
|   cur.execute(sql_ProjectsTable)
|   cur.close()
|   except Error as e:
|   print(e)

What else?

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


[issue37741] importlib.metadata docs not showing up in the module index

2019-08-05 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

There's an importlib.metadata.rst file which describes how to use the API, but 
that doesn't appear to be linked from either the main library ToC or the 
importlib documentation itself.  I'll see if I can put together a PR to fix 
this.

--
assignee: docs@python -> barry

___
Python tracker 

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



[issue37762] IDLE very slow due a super long line output in chunks

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

One may copy and paste small chunks of code and output into a message. By 'demo 
script', I presume you mean the following.

import tensorflow as tf
mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(512, activation=tf.nn.relu),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation=tf.nn.softmax)
])
model.compile(optimizer='adam',
  loss='sparse_categorical_crossentropy',
  metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)

The boxes represent characters that cannot be displayed in the tk Text widget 
with the current font.  They represent whatever is printed in the standard 
shell, which you call 'normal', which implies that they are not control chars.  
Since the length of the box run is 1 less than the length of the visible data, 
my guess is that the intended format is alternating lines something like
 9696/6 acc: 0.8691
==
except that the line separators are some non-ascii char.  (Note that the 
sequence of [] substitutes in one less than the sequence of printable ascii, 
which would make it impossible to set the shell width so that wrapped chunks 
line up.)

The problem is the absence of '\n' newlines, which I consider a bug in keras. 
The result is one line that grows in chunks to some humongous length.  This is 
eventually deadly to tk Text widgets.  The symptom is that chunks are added 
quickly at first, then more slowly, then to a crawl, and maybe a stop.  Here is 
a short test.

from __future__ import print_function  # To run with 2.7.
for i in range(10):
print('%6s' % i, end='')

On my Win10 machine with 3.8.0b3 and tk 8.6.9 (see Help => About IDLE for the 
latter), slow down is evident after 1 chars (200 chunks) and crawling by 
4 chars.  It might be worse on Linux and Mac.

I added a note about auto-squeezing the long lines in chunks case to #35855.  I 
expect to close this as 3rd party, or as a duplicate of #1442493.

--
title: IDLE very slow due to special characters -> IDLE very slow due a super 
long line output in chunks

___
Python tracker 

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



[issue35855] IDLE squeezer: improve unsqueezing and autosqueeze default

2019-08-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

A4: Autosqueeze long lines output in chunks.  tensorflow.keras appears to do 
this.  See #37762.  Easy reproducer:

for i in range(1):
print('%6s' % i, end='')

--

___
Python tracker 

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



[issue37757] TargetScopeError not raised for comprehension scope conflict

2019-08-05 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

I know the PEP defines TargetScopeError as a subclass of SyntaxError, but it 
doesn't really explain why a subclass is necessary.  I think seeing 
"TargetScopeError" will be a head scratcher.  Why not just SyntaxError without 
introducing a new exception?

--
nosy: +barry

___
Python tracker 

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



[issue37706] IDLE: fix sidebar click-drag bug and macOS test failures

2019-08-05 Thread Steve Dower


Steve Dower  added the comment:

All I can add is these are the steps: 
https://github.com/python/cpython/blob/master/.azure-pipelines/macos-steps.yml

The Linux steps use xvfb, but the macOS steps do not. And we don't do anything 
at all to install Tcl/Tk on the build agent.

--

___
Python tracker 

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



[issue32912] Raise non-silent warning for invalid escape sequences

2019-08-05 Thread Ned Deily


Change by Ned Deily :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue37722] imaplib crashes when trying to read a letter from an imap server imaps.почта.рус

2019-08-05 Thread My Tran


Change by My Tran :


--
components: +email -Library (Lib)
nosy: +barry, r.david.murray

___
Python tracker 

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



[issue37764] email.Message.as_string infinite loop

2019-08-05 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +maxking

___
Python tracker 

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



[issue37764] email.Message.as_string infinite loop

2019-08-05 Thread My Tran


New submission from My Tran :

The following will hang the system until it runs out of memory. 

import email
import email.policy

text = """From: u...@host.com
To: u...@host.com
Bad-Header:
 =?us-ascii?Q?LCSwrV11+IB0rSbSker+M9vWR7wEDSuGqmHD89Gt=ea0nJFSaiz4vX3XMJPT4vrE?=
 =?us-ascii?Q?xGUZeOnp0o22pLBB7CYLH74Js=wOlK6Tfru2U47qR?=
 =?us-ascii?Q?72OfyEY2p2=2FrA9xNFyvH+fBTCmazxwzF8nGkK6D?=

Hello!
"""

eml = email.message_from_string(text, policy=email.policy.SMTPUTF8)
eml.as_string()

--
components: email
messages: 349055
nosy: barry, mytran, r.david.murray
priority: normal
severity: normal
status: open
title: email.Message.as_string infinite loop
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: base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread MRAB

On 2019-08-05 16:01, Hongyi Zhao wrote:

Hi,

I read the source code of of `humanize/filesize.py' and find the 24 line
writing as follows:

base = 1024 if (gnu or binary) else 1000

It seems this is not the standard usage of if ... else 

Is this a variant of lambda or some others?  Could you please give me
some more hints?

It's a "conditional expression" (also called a "ternary if") and it's 
mentioned in Python's documentation.


In this case it does the same as:

if gnu or binary:
base = 1024
else:
base = 1000
--
https://mail.python.org/mailman/listinfo/python-list


Re: base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread Rhodri James

On 05/08/2019 16:01, Hongyi Zhao wrote:

Hi,

I read the source code of of `humanize/filesize.py' and find the 24 line
writing as follows:

base = 1024 if (gnu or binary) else 1000

It seems this is not the standard usage of if ... else 


It's a perfectly standard conditional *expression* (see 
https://docs.python.org/3/reference/expressions.html#conditional-expressions), 
not an if *statement* at all.  It's the equivalent of "?:" in C and 
C-like languages.


In general conditional expressions look like:

   if  else 

Python evaluates the .  If it is true, the expression 
evaluates to .  If it is false, it evaluates to 
.  In this specific case, "base" is assigned 1024 if "gnu" 
or "binary" are true, else it is assigned 1000.


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


Re: Python scripts

2019-08-05 Thread Rhodri James

On 04/08/2019 10:29, Arun Kumar wrote:

In python application in scripts folder files are missing then how to
get those files.


That depends on exactly what you mean by "files are missing".  If (most 
likely) the application is trying to import a third party module that 
you don't have installed, the documentation coming with the application 
should tell you what to install and where to get it from.


If files are genuinely missing from the script folder (wherever/whatever 
that is), contact the author of the application.


If all else fails, read the documentation ;-)

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


[issue37763] Need setup.py to pick up -isystem flags from CPPFLAGS

2019-08-05 Thread Johan Herland


Change by Johan Herland :


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

___
Python tracker 

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



Python scripts

2019-08-05 Thread Arun Kumar
Dear sir

   In python application in scripts folder files are missing then how to
get those files.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37763] Need setup.py to pick up -isystem flags from CPPFLAGS

2019-08-05 Thread Johan Herland


New submission from Johan Herland :

First time contributor here, still learning the ropes.

We're cross-compiling python in an environment where we set up CPPFLAGS, 
LDFLAGS, etc. to point directly to the locations where we have built Python's 
dependencies. For example, we will typically build Python in an environment 
that includes:

  CPPFLAGS=\
-isystem /path/to/ncurses/build/include \
-isystem /path/to/libffi/build/include \
-isystem /path/to/zlib/build/include \
-isystem /path/to/openssl/build/include \
-isystem /path/to/readline/build/include
  
  LDFLAGS=\
-L/path/to/ncurses/build/lib \
-L/path/to/libffi/build/lib \
-L/path/to/zlib/build/lib \
-L/path/to/openssl/build/lib \
-L/path/to/ciscossl-fom/build/lib \
-L/path/to/readline/build/lib

setup.py already picks up our -L options from LDFLAGS and propagates them into 
the build commands, but the -isystem options from CPPFLAGS are currently 
ignored.

I will post a PR that teaches setup.py to handle -isystem options in CPPFLAGS 
the same way it currently handles -I options.

--
components: Cross-Build
messages: 349054
nosy: Alex.Willmer, jherland
priority: normal
severity: normal
status: open
title: Need setup.py to pick up -isystem flags from CPPFLAGS
type: enhancement
versions: Python 3.8, Python 3.9

___
Python tracker 

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



base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread Hongyi Zhao
Hi,

I read the source code of of `humanize/filesize.py' and find the 24 line 
writing as follows:

base = 1024 if (gnu or binary) else 1000

It seems this is not the standard usage of if ... else 

Is this a variant of lambda or some others?  Could you please give me 
some more hints? 

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35545] asyncio.base_events.create_connection doesn't handle scoped IPv6 addresses

2019-08-05 Thread Michael Felt


Michael Felt  added the comment:

I did not ask back in June - but could this also be backported to 3.7. I am 
trying very hard to have all tests also passing on 3.7. as @asvetlov is ok with 
a skipped test for AIX - see https://bugs.python.org/issue35545#msg344003

I can make the backport, if needed.

--

___
Python tracker 

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



[issue33997] multiprocessing Pool hangs in terminate()

2019-08-05 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Removed Python 3.6 as it is in security fixes now.

--
versions: +Python 3.8, Python 3.9 -Python 3.6
Added file: https://bugs.python.org/file48532/test_multiprocessing.py

___
Python tracker 

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



Re: Any bad patterns we can find with static analyzing

2019-08-05 Thread Terry Reedy

On 8/5/2019 8:11 AM, Batuhan Taskaya wrote:

I am developing a project called Inspector Tiger (from monty python
:)) and with that project i am trying to perform a static check over
the source code to find common mistakes. If you know a common mistaken
pattern, it would be really great to share it with me or implement it
and PR to inspector tiger.

Source: https://github.com/thg-consulting/inspectortiger


Read the Python FAQ and search for documents with things like 'Python 
gotchas' or 'Python warts'.  You can also find threads here and on 
Stackoverflow where the gist of a problem is using bad patterns.



--
Terry Jan Reedy

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


[issue33997] multiprocessing Pool hangs in terminate()

2019-08-05 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
components: +Library (Lib) -Windows

___
Python tracker 

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



[issue33997] multiprocessing Pool hangs in terminate()

2019-08-05 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi, I got bit by this bug last week, I wrote an example that reproduce the 
basic idea of our program main loop and it hangs

 - around 20% of the time with a release build of Python 3.7.4
 - around 6% of the time with a debug build of Python 3.7, 3.8 and 3.9

With some of our inputs, it hangs nearly all the time but I cannot post them 
here.

I tested PR 8009 and it solves the issue. It seems to me that it is an 
appropriate fix for this.

--
Added file: https://bugs.python.org/file48531/multiprocessing_hangs.py

___
Python tracker 

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



[issue37762] IDLE very slow due to special characters

2019-08-05 Thread Bernhard Hiller


New submission from Bernhard Hiller :

After installing tensorflow, I tried to run the demo script found at 
https://www.tensorflow.org/tutorials?
In a common python shell, the "model.fit(x_train, y_train, epochs=5)" step 
takes a few minutes. In IDLE, no end is in sight after half an hour.
While the output looks normal in the common shell, IDLE shows some control 
characters (see attached screenshot).
Windows Task Managers shows a "pythonw.exe" process taking up 25% of CPU (i.e. 
1 of 4 cores).

--
assignee: terry.reedy
components: IDLE
files: Python374-3.PNG
messages: 349050
nosy: Bernie, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE very slow due to special characters
type: performance
versions: Python 3.7
Added file: https://bugs.python.org/file48530/Python374-3.PNG

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-05 Thread hai shi


hai shi  added the comment:

It's a big problem, no ability to answer this question :(

--

___
Python tracker 

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



Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread Hugh Sasse
I might not have followed this thread closely enough.  I remembered 
there is a thing called Copilot.


It connects two machines so that two people can work together.

I've never used it, and have no connection with the company.  I remember 
reading about it on a page


written by Joel Spolsky.

https://www.copilot.com/About

If this is the wrong answer, it may at least help define the negative 
space around what you want.


Hugh

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


[issue33829] C API: provide new object protocol helper

2019-08-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> rejected
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



[issue33829] C API: provide new object protocol helper

2019-08-05 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

I agree with rejecting and closing this issue.

--
nosy: +jdemeyer

___
Python tracker 

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



Any bad patterns we can find with static analyzing

2019-08-05 Thread Batuhan Taskaya
I am developing a project called Inspector Tiger (from monty python
:)) and with that project i am trying to perform a static check over
the source code to find common mistakes. If you know a common mistaken
pattern, it would be really great to share it with me or implement it
and PR to inspector tiger.

Source: https://github.com/thg-consulting/inspectortiger
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread Chris Angelico
On Mon, Aug 5, 2019 at 8:54 PM DL Neil  wrote:
>
> On 3/08/19 5:50 PM, Chris Angelico wrote:
> > On Sat, Aug 3, 2019 at 3:36 PM DL Neil  
> > wrote:
> >>
> >> On 3/08/19 4:02 PM, Terry Reedy wrote:
> >>> Good.  Master-satellite would be much easier.  We added line numbers to
> >>> IDLE's editor last week, so verbal feedback from satellite to master
> >>> should be sufficient for many purposes.
>
> Elsewhere in this thread others, have been looking at NAT and broker
> arrangements. It has been v.interesting to read.
>
> If it is a corporation's project, then this is an option. The business
> of choosing ports and opening firewalls is a (?mere) matter of
> standardisation and coordination. (cough, cough, mumble, mumble)
>
> However, if we are talking about a public product, eg TeamViewer; then
> ease of operation comes to the fore. (much though I disagree with what
> amounts to an abuse of port-80 - specialists trying to 'manage' Internet
> traffic must really have things to say about such)
>
> The reason I mentioned "TeamViewer" (and A.N.Other mentioned BitTorrent)
> is that client-server is so much easier to implement - even if (using
> this example) the two (pair-programming) start as clients to some
> central server, but later comms are 'delegated'/re-directed to become
> peer-to-peer or go-direct. In the case of TV, which I use in (unpaid,
> much put-upon, family - you know this song!) 'technical support' mode,
> both the one seeking help and my own computer have to separately log-in
> to the TV system, the second asking to connect to the first...

Sometimes there can be magical firewall penetration tricks that allow
the traffic to go peer-to-peer after an initial handshake with some
central server, but this has its own problems. On any network that I
control, such tricks are disabled; if you want to listen to
connections from the outside world, you get my explicit permission and
an actual line in the firewall configs.

> Also, there are scenarios when both (of the pair) might be contributing
> by 'coding' concurrently, eg one writing tests and the other code, or
> one writing one class and the other a second. (but you can debate if
> that is "pair-programming")

No, that's not pair programming. That's collaboration on a project,
but it's not the sort of thing where you need to see the other
person's screen.

> > TLS doesn't really solve this problem. If you have a single central
> > server, TLS just tells you that you're talking to that server, without
> > proving anything about who's on the other end. Even if you directly
> > connect the two nodes, TLS wouldn't prove who that is, unless you get
> > a dedicated certificate. What it *can* prove is that your data stream
> > hasn't been tampered with en route, but the problem of receiving code
> > from strangers is still an issue. Ultimately, pair programming depends
> > on a measure of trust - you have to be confident that the person
> > you're pairing with isn't going to be maliciously messing with your
> > system.
>
> As above, using a client-server relationship, thus TLS/SSH are
> relatively natural, and certainly common, components of the whole.

That's fine if one end is a dedicated server.

> I assume a level of trust. Why would you pair-program with someone
> untrustworthy? Either you're a team or not!

What about poisoning the channel externally, though? If you can't
directly connect a TCP socket between the two peers, the traffic will
have to go out on the internet.

> Is it acceptable to train folk to code (in a particular language)
> without also covering the likely tools they will (also) use?
>
> So with Python, during the first lesson we could jump straight into a
> one-line print( "hello world" ) program using the REPL. However, an
> editor will be employed as soon as we want our code to persist. So
> should we (immediately) promote the use of a professional editor/IDE, eg
> PyCharm, Sublime Text, Codium, Eclipse; or a 'traditional' character
> editing tool, eg Vi, emacs?
> (please no 'religious wars' just because I mentioned both in the same
> sentence!)

At my work, we instruct students on how to set up one particular tech
stack, including an editor, linter, source control, etc, etc. We're
clear with them that these are not the only options, but for the sake
of bootcamp time pressures, we aren't going to show them any others.

Depending on what you're trying to do, it MAY be acceptable to teach
just the language. But that won't make someone employable on its own.

Like everything, "it depends" :)

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


[issue37752] Redundant Py_CHARMASK called in some files

2019-08-05 Thread Jordon.X


Jordon.X <9651...@qq.com> added the comment:

After the full search for the project code, there are more than a dozen similar 
issues that need to be modified. A new PR will be added later.

--
title: Redundant Py_CHARMASK called in normalizestring(codecs.c) -> Redundant 
Py_CHARMASK called in some files

___
Python tracker 

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



Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread DL Neil

On 5/08/19 9:59 PM, Dennis Lee Bieber wrote:

On Mon, 5 Aug 2019 18:52:14 +1200, DL Neil 
declaimed the following:


Herewith a progress-report, and an attempt to respond to (interposed)
questions:-


I didn't have questions so much as just comments based on
documentation...


Your advice, ideas, and the effort you've invested, are greatly 
appreciated. Thank you!




Service:
There are/were two: the original Cloud9/C9, and the newer/bigger/better
version since Amazon took-over. There are differences!


The core of the "original" is what has been provided on the BBB (and is
available via an older download page -- it WILL run on a Windows box). The
"original" includes the IDE functions AND runs as the web-server.


As you would expect, the newer Cloud9 is clearly superior, in function. 
I don't think there's a F/LOSS download though!

(would be more than a slight surprise were Amazon to do so)

There was a product on the original list: Koding. IIRC this is delivered 
as a docker module?Kubernetes. I suppose such is beyond the capacities 
of a BBB, even a RPi4 (USB-C confusion and higher-current demands 
notwithstanding)*.


I don't think I'm going to find sufficient time to try that option - and 
offering the PUG attendees three choices now (TeamViewer, 
PythonAnywhere, and Cloud9) is probably more than enough and heading 
into 'overload' territory.


That said, the idea of being able to completely control the whole 
service, from-soup-to-nuts, is attractive - for reasons alluded-to earlier.


* was blown-away by the price/specs of the nVidia Jetson Nano (similar 
form-factor, SBC + add-ons), which I've been looking at for image 
manipulation and video editing/production. Sadly, the BBB may have 'had 
its day'?




Now... Off to report for jury pool summons... Having an alarm go off at
0500 is obscene [my normal is 0730, second alarm at 0800, and crawl out of
bed at 0900, get on computer between 1000 and 1100).


The claim is that "The wheels of justice turn slowly, but grind 
exceedingly fine.", so please ensure that you don't fall into the machinery!


Perhaps you'll be more in the mood for Robin Williams: (something like) 
0300! [pronounced oh-three-hundred, ie 3am, which he described as] Oh as 
in: Oh my God it's early!
From the movie "Good Morning Vietnam", and employing typical sardonic 
military humor. Another (borrowed from a British unit), which may apply 
well to your jury-duty is "hurry up and wait"...

(hope it goes well/is not too boring!)
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread DL Neil

On 4/08/19 8:20 AM, Chris Angelico wrote:

On Sun, Aug 4, 2019 at 4:46 AM Terry Reedy  wrote:

On 8/3/2019 1:50 AM, Chris Angelico wrote:
Since master and clone are copies of the same program, switching roles
should be simple, and easier than trading seats.


Should be indeed, though having accidentally painted myself into a
corner on many occasions, I would say it's worth writing this down as
a goal all the same :)


+1
Done!



However, I think it would be an extremely useful feature if the output
from running the program could also be replicated to the other client.
Let's say you're developing a Python script that connects to a
database (eg psycopg2 + PostgreSQL). To run that locally, you'd need
your own replica of the database, and that often means having your own
credentials (ie having the script able to choose which set of
credentials to use), replicating the database schema, and possibly
even getting a duplicate of the current table contents. Way WAY easier
to just run it on one computer and copy the output.


I did not think of this scenario because I don't currently program with
external libraries and DBs.  Sending output seems to be a must, with
running delivered code an option depending on trust and code review.  It
does, however, require a control message to switch incoming text from
editor to shell.


Rather than having such a control message, perhaps it could be
possible to have any number of "target window" channels? So you could
have two editor windows and a shell, or even multiple shells, if Idle
can do that in one process. I'm not sure how Idle's architecture is;
in my experimentation, I was only able to get a single execution
window.


A chat window? (yes, multiple tabs, or panels, or a floating window)
An audio channel?



I believe bittorrent somehow deals with the issue, but I don't know how
much a broker is used after the initial seeding.  I believe some
player-hosted multiplayer games run peer-to-peer after the initial
introduction, but I don't know for sure.


Hmm, bittorrent's broker is just for finding peers - it doesn't
actually transfer any content. I'm pretty sure two behind-NAT torrent
clients are unable to communicate unless one of them has a port
forwarded to it.


Restriction to local networks might have some use.  There have been
programming classes where a teacher uses IDLE projected on an overhead
screen.  In at least some cases, a large type size (25-40) is needed.
It might be nicer to deliver to each students computer.


The easiest way would be to have the main Idle engine able to listen
on a socket OR connect to one, and then "restricting to LAN" is simply
a matter of managing it in your firewall (or, in the case of many NAT
networks, simply a matter of doing nothing).

The broker would be a basic echo server, and if desired, it could
handle encryption (TLS). Since there would potentially be many
concurrent Idle replications happening, there'd need to be some sort
of "room name" or something, but it could still be very simplistic.

This would be a very cool feature, especially since it could bring
ultra low latency pair programming even to people on mobile
connections.


+1
(don't forget those of us whose "high speed broadband" still falls well 
short of the promised "information super highway"!)

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


Re: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread DL Neil

On 4/08/19 6:44 AM, Terry Reedy wrote:

On 8/3/2019 1:50 AM, Chris Angelico wrote:
On Sat, Aug 3, 2019 at 3:36 PM DL Neil 
 wrote:


On 3/08/19 4:02 PM, Terry Reedy wrote:
Is that really "p-p" or more "code review"?


The latter.  The quotes here mean "the closest I currently come to pair 
programming".  I have often *wished* for live interaction instead.


See elsewhere for suggestions of how Idle might be used for such (not 
merely as an 'editor' - assuming that is 'all' it is now)



Since master and clone are copies of the same program, switching roles 
should be simple, and easier than trading seats.


+1
operative words "should be"!



However, I think it would be an extremely useful feature if the output
from running the program could also be replicated to the other client.
Let's say you're developing a Python script that connects to a
database (eg psycopg2 + PostgreSQL). To run that locally, you'd need
your own replica of the database, and that often means having your own
credentials (ie having the script able to choose which set of
credentials to use), replicating the database schema, and possibly
even getting a duplicate of the current table contents. Way WAY easier
to just run it on one computer and copy the output.


I did not think of this scenario because I don't currently program with 
external libraries and DBs.  Sending output seems to be a must, with 
running delivered code an option depending on trust and code review.  It 
does, however, require a control message to switch incoming text from 
editor to shell.


Watching the Cloud9 system 'paint' on one machine/browser a moment after 
I'd typed code using a second machine, brought me a childish delight 
(after all the reading, learning, and fiddling of accounts and 
permissions to get that far)



Restriction to local networks might have some use.  There have been 
programming classes where a teacher uses IDLE projected on an overhead 
screen.  In at least some cases, a large type size (25-40) is needed. It 
might be nicer to deliver to each students computer.


Disagree: there's a reason it's called the "world-wide" web!

Having said that: limiting to LAN makes life SO much easier.

(probably mentioned earlier/elsewhere)
I *HATE* using large screens, OHP panels, video projectors, etc. 
Firstly, they always seem to be going wrong - the problem of too many 
'moving parts'. Recently I was asked to give a user-oriented course in 
DB retrieval (cf programmers using SQL). I decided to use MySQL's 
Workbench, but that screen is so 'busy'. The local equipment was some 
VGA or not-much-better projector. Screen text was totally unreadable!


My preference these days is to slave everyone's screen to mine, using 
VNC software. It's just like a slide/movie projector and as the airlines 
like to advertise: everyone has their own personal screen! (plus, can 
adjust resolution, control screen enlargement, etc, to suit personal 
preferences)


However, a lot of training is moving away from "lectures" and certainly 
"class rooms". It is becoming an async world, and even if a group 
congregate into a single room, classes are organised so that each can 
work at his/her own pace. So, features to join all in "lock step" may 
not be so often required...

(apologies if more than two-cents' worth)
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue37562] PEP 590 implementation may have introduced a performance regression

2019-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
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: Remote/Pair-Programming in-the-cloud

2019-08-05 Thread DL Neil

On 3/08/19 5:50 PM, Chris Angelico wrote:

On Sat, Aug 3, 2019 at 3:36 PM DL Neil  wrote:


On 3/08/19 4:02 PM, Terry Reedy wrote:

Good.  Master-satellite would be much easier.  We added line numbers to
IDLE's editor last week, so verbal feedback from satellite to master
should be sufficient for many purposes.


Elsewhere in this thread others, have been looking at NAT and broker 
arrangements. It has been v.interesting to read.


If it is a corporation's project, then this is an option. The business 
of choosing ports and opening firewalls is a (?mere) matter of 
standardisation and coordination. (cough, cough, mumble, mumble)


However, if we are talking about a public product, eg TeamViewer; then 
ease of operation comes to the fore. (much though I disagree with what 
amounts to an abuse of port-80 - specialists trying to 'manage' Internet 
traffic must really have things to say about such)


The reason I mentioned "TeamViewer" (and A.N.Other mentioned BitTorrent) 
is that client-server is so much easier to implement - even if (using 
this example) the two (pair-programming) start as clients to some 
central server, but later comms are 'delegated'/re-directed to become 
peer-to-peer or go-direct. In the case of TV, which I use in (unpaid, 
much put-upon, family - you know this song!) 'technical support' mode, 
both the one seeking help and my own computer have to separately log-in 
to the TV system, the second asking to connect to the first...




Elsewhere in the thread there is much discussion of this. Regardless of
the "we are all adults here" philosophy, my feeling (stuck-in-the-mud
though it might be) is that one person/system has to have 'control', and
the other, the 'pair' (or the 'tutor') is invited to see/do 'whatever'.
However, r/o would be a show-stopping limitation.


When pair programming involves training (tutor and student, or senior
and junior programmer), forcing the more experienced person to stay
hands-off is a very good thing; it forces the less experienced person
to actually keyboard every change, and thus is more likely to
understand what's going on. But when it's two peers, you'll often want
to switch out who's in control. Depending on the architecture, this
might be a simple matter of flipping a switch and changing who's
master and who's on a read-only clone.


I can't see the r/o version in pair-programming - although 'elsewhere' 
people have mentioned programmer interviews, so maybe that's it.


In pair-programming both have a contribution to make. The key, requiring 
both technical and social/inter-personal considerations (see discussion, 
elsewhere), is to understand one's current rôle, and to have a clear 
'break' when 'swapping seats' - in radio, that is the reason for 
finishing with "over" (cue Leslie Nielsen sketch), and on a ship's 
bridge there is a clear announcement, eg "Fred has the conn", so that 
'everyone' knows who's in-charge 'now'!


To me, that is mostly an inter-personal communications issue. I don't 
really want 'some computer' deciding when and what I might do. Others 
might prefer the opposite.


Also, there are scenarios when both (of the pair) might be contributing 
by 'coding' concurrently, eg one writing tests and the other code, or 
one writing one class and the other a second. (but you can debate if 
that is "pair-programming")


Python's philosophy already covers this with: "we're all adults here"...
(see also 'trust', below)



4. Require encryption of some sort if over the public internet.  Just
because people download code from strangers over http is not a reason to
encourage carelessness.  I am pretty ignorant on what this would mean.


TLS?


TLS doesn't really solve this problem. If you have a single central
server, TLS just tells you that you're talking to that server, without
proving anything about who's on the other end. Even if you directly
connect the two nodes, TLS wouldn't prove who that is, unless you get
a dedicated certificate. What it *can* prove is that your data stream
hasn't been tampered with en route, but the problem of receiving code
from strangers is still an issue. Ultimately, pair programming depends
on a measure of trust - you have to be confident that the person
you're pairing with isn't going to be maliciously messing with your
system.


As above, using a client-server relationship, thus TLS/SSH are 
relatively natural, and certainly common, components of the whole.


OT: the world of certificates has been revolutionised by LetsEncrypt.org 
and their free services.


I assume a level of trust. Why would you pair-program with someone 
untrustworthy? Either you're a team or not!


That said, and thinking back to the different scenarios (above), I can 
see the r/o option being useful in such a case. For example, some of my 
stats clients like to run through the code. It's a form of 
checking/testing, so I don't mind - they read (the math of) code far 
better than they can write/structure it! However, I definitely don't 

asyncio, transports, protocols, etc.

2019-08-05 Thread Hugh Sasse

Hello,
I didn't get a response to this before, possibly because of lack of 
concision.   I'd like to ask whether (provided I'm understanding this):


https://docs.python.org/3/library/asyncio-protocol.html#tcp-echo-server

could be improved by adding:
"""
  Create a TCP echo server using the loop.create_server() method, send
  back received data.  This is done by defining the Protocol, which gets
  the transport from the server when it is created by asyncio.
"""
before it, because these concepts have only just been introduced, and 
also whether the echo server should really be closing the connection, 
given RFC 862 seems to suggest it should stay open.


Original message below.

Thank you,
Hugh


Hello,

I'm trying to get my head around asyncio, and I think I'm mostly there 
now, (but expect to be proved wrong :-)!).  It appears to be about the 
newest of the PEPs according to my searches, including PEP 0, so I don't 
expect a huge amount of supporting documentation out there yet.


Looking at:

https://docs.python.org/3/library/asyncio-protocol.html#tcp-echo-server

I know the page introduces the relationships between protocols, 
transports and the servers/clients that use them.  When I read this code 
it took me longer than I would wish :-) to realise that the example 
defining the Echo server was doing this through the protocol, (yes, it 
says it *right there* :-)!) and not a Server class, so for some time I 
was puzzled about where 'transport' was being defined.  Given these 
concepts are new on this page, at least ostensibly, would it make sense 
to introduce this example with something like:


"""
  Create a TCP echo server using the loop.create_server() method, send
  back received data.  This is done by defining the Protocol, which gets
  the transport from the server when it is created by asyncio.
"""

just to refresh the connection between the things in the mind of the reader?

Also, according to my reading of RFC 862, I don't think the Echo server 
should be closing the connection just after echoing:


"""
TCP Based Echo Service

   One echo service is defined as a connection based application on TCP.
   A server listens for TCP connections on TCP port 7.  Once a
   connection is established any data received is sent back.  This
   continues until the calling user terminates the connection.

"""

I could have missed something here though. (If it is this protocol that
is under discussion here, then a link might be useful, as well?)

Why does this matter?  Because it was not clear to me whether the 
closing of the connection was something that had to happen, as part of 
the functionality of the echo service or of asyncio itself.  If I'm 
implementing something that does something based on the cmd or cmd2 
module, interpreting commands, then having some kind of dialogue with 
the server matters.


Writing documentation so that everyone will understand it and NOT get 
the wrong end of the stick is difficult.  I don't know if this would 
make things more confusing for others, or even if it might have helped 
me. At the moment, I think it might be in the right direction, though.


Thank you,

Hugh


--
--
Dr. Hugh Sasse, BSc(Hons), PhD
Computer Systems Electronic Engineer
School of Engineering and Sustainable Development
DE MONTFORT UNIVERSITY



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


[issue36974] Implement PEP 590

2019-08-05 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Should we add a note like "if you get a 'SystemError: bad call flags' on 
> import, check the descriptor flags of your functions" in What's New in Python 
> 3.8?

A better solution would be to change the error message. We could change it to 
something like SystemError("bad flags 0x2 for PyCOMPS_categories_match")

But maybe it's not worth it. Are there many projects that define 
functions/methods but never call them?

--

___
Python tracker 

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



[issue37562] PEP 590 implementation may have introduced a performance regression

2019-08-05 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Please close

--

___
Python tracker 

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



  1   2   >