[issue30215] Make re.compile() locale agnostic

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 898ff03e1e7925ecde3da66327d3cdc7e07625ba by Serhiy Storchaka in 
branch 'master':
bpo-30215: Make re.compile() locale agnostic. (#1361)
https://github.com/python/cpython/commit/898ff03e1e7925ecde3da66327d3cdc7e07625ba


--

___
Python tracker 

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



Re: Promiscuous ports under Linux

2017-05-04 Thread Peter Pearson

On Thu, 4 May 2017 18:04:02 + (UTC), Grant Edwards wrote:
> On 2017-05-04, Peter Pearson  wrote:
>
>> I'm curious to survey all my LAN traffic in various ways, and it seems
>> likely that I will see phenomena that I don't understand, and focussing
>> in on those phenomena is likely to require more flexible filtering
>> than Wireshark can provide.  I expect to leave this process running for
>> maybe 24 hours at a stretch, maybe longer, with real-time alerts when
>> interesting things occur.
>
> You can libpcap (which is what wireshark uses on Linux) to deal with
> the details of capturing the packets and do the analysis in Python.
>
>> Maybe Wireshark can do everything I'll ever need to do, but it seems
>> so complicated, and Python seems so simple . . .
>
> I've been using pylibpcap for yonks, and have no complaints.
>
>   https://sourceforge.net/projects/pylibpcap/
[snip]

Hey, that might do the job.  Thanks!

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Elegant way to merge dicts without overwriting keys?

2017-05-04 Thread Peter Otten
Malcolm Greene wrote:

> I have a bunch of pickled dicts I would like to merge. I only want to
> merge unique keys but I want to track the keys that are duplicated
> across dicts. Is there a newer dict-like data structure that is fine
> tuned to that use case?
> Short of an optimized data structure, my plan is to convert dict keys to
> sets and compare these sets to determine which keys are unique and can
> be merged and which keys are dupes and should be tracked in that manner.
> At a high level, does this sound like a reasonable approach?
> Thank you,
> Malcolm

Do you want

merge(dict(a=1, b=2), dict(a=10, c=30)) --> dict(b=2, c=30)

or

merge(dict(a=1, b=2), dict(a=10, c=30)) --> dict(a=1, b=2, c=30)

? In the latter case just reverse the updates, in the former you can operate 
directly on the keys:

>>> a = dict(a=1, b=2)
>>> b = dict(a=10, c=30)
>>> a.keys() & b.keys()
{'a'}
>>> a.keys() ^ b.keys()
{'c', 'b'}

For Python 2 replace keys() with viewkeys().

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


[issue30243] Core dump when use uninitialized _json objects

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Repeated calling of the __init__ method caused memory leaks.

--

___
Python tracker 

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



Re: Python 2.7 on Windows: Copy install

2017-05-04 Thread eryk sun
On Thu, May 4, 2017 at 8:27 PM, jeff saremi  wrote:
> I have scoured the net for any hints on this. We have some prod machines 
> where we're not able to run MSI installations.
> Is it possible to copy Python2.7 from say c:\Python2.7 from one machine to 
> another?
> What other steps do we need beyond the following since these DONT work:

Before going deeper into writing scripts to manually install Python,
have you considered using a portable version such as WinPython [1]. It
has an option to register itself.

[1]: https://winpython.github.io

> 3. Add C:\python2.7\Lib and C:\python2.7\Lib\site-packages to PYTHONPATH

Did someone tell you to do that? If so, please tell them it's wrong.
PYTHONPATH should never include those directories. It takes precedence
over the standard library, so adding those directories will break
other versions of Python on the system.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30243] Core dump when use uninitialized _json objects

2017-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As well as __name__, __qualname__, __module__, __bases__, __call__, mro, etc.

--

___
Python tracker 

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



Re: Python 2.7: no such module pip

2017-05-04 Thread eryk sun
On Thu, May 4, 2017 at 8:24 PM, jeff saremi  wrote:
> Did a fresh install of python-2.7.amd64.msi on windows 10.
>
> The install finishes with success. Python runs. No pip when the following is 
> run:
>
> C:\> python -m pip install elastalert
> C:\Python27\python.exe: No module named pip

Maybe you didn't select the option to install pip, or maybe it failed
and wasn't reported. Try installing the bundled pip manually:

python -m ensurepip -Uv
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If the path attribute can be None or list it looks to me that it isn't a 
filesystem path, and it may be incorrect to use os.fspath() with it. How this 
attribute is used? What wrong if left it a pathlib.Path?

--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As you said, calling close() can have side effects (for example invoking 
self._cont_handler.endDocument()). This was the argument against PR 1444.

It seems to me that if _entity_stack is not empty (this happens in case of 
error in entity parsing) the close() method does nothing. And maybe there are 
other leaks in entity parsing.

--

___
Python tracker 

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



Python 2.7: no such module pip

2017-05-04 Thread jeff saremi
Did a fresh install of python-2.7.amd64.msi on windows 10.

The install finishes with success. Python runs. No pip when the following is 
run:

C:\> python -m pip install elastalert
C:\Python27\python.exe: No module named pip




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


Re: Python 2.7 on Windows: Copy install

2017-05-04 Thread MRAB

On 2017-05-04 21:27, jeff saremi wrote:

I have scoured the net for any hints on this. We have some prod machines where 
we're not able to run MSI installations.
Is it possible to copy Python2.7 from say c:\Python2.7 from one machine to 
another?
What other steps do we need beyond the following since these DONT work:
1. Copy all files

2. Add the new Python2.7\bin to PATH

3. Add C:\python2.7\Lib and C:\python2.7\Lib\site-packages to PYTHONPATH


thanks

Jeff


There's also python27.dll in C:\Windows\System32.

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


Re: os.getlogin() Error

2017-05-04 Thread Cameron Simpson

On 04May2017 20:42, Wildman  wrote:

On Fri, 05 May 2017 09:00:58 +1000, Cameron Simpson wrote:

On 04May2017 15:03, Wildman  wrote:

The program installs using the Debian package system (.deb) and an
entry is created in the Applications Menu.  The strange thing is
that the crash only occurs when the program is run from the menu.
If I open a terminal and run the program from there, the program
runs fine.


And this supports that.

getlogin is not magic, and can be overused. The Python docs say "Return the
name of the user logged in on the controlling terminal of the process." Clearly
that will fail.

When you start from a terminal, your command will have that as its controlling
terminal unless it has gone out of its way not to. When you start from a menu,
usually that menu system will not be associated with a terminal. In this case
you need to fall back on other methods of figuring out "who is logged in".


What I don't understand is why the program will run from the menu
on some Linux distros and not others.  I might need to take a
closer look at the structure of the .desktop file used to launch
my program.  Thanks.


I presume it will come down (in this instance) to the controlling tty. Put some 
testing code into something you can invoke from a menu. Try to open '/dev/tty' 
and see what error results. See if stdin, stdout and stderr are attached to 
terminals (or even open). You can os.fstat(sys.stdin.fileno()) and so forth.


And direct stderr to a logfile so you get to see any stack traces; you can 
write other info there, or dup stdout to the same logfile.


You can "tail -f" the logfile from a terminal to see your test results easily.

It may also depend on how X11 is started. On some distros you may have a GUI 
login, and your X11 session may have no controlling terminal.


On my systems I run text consoles and use "startx" to kick things off. I'd 
expect my window manager etc to have a controlling tty, the console. Unless 
something lets go of it deliberately before kicking off my desktop.


So you're right, different distros and setups may well present somewhat 
different inherited environments to whatever presents your menus.


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


bugs.python.org registration never completes

2017-05-04 Thread jeff saremi
i've been waiting for my confirmation email. Never received it

Someone should look into the registration. And there is no admin emails where 
you could send your issue to!

thanks

Jeff

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


Python 2.7 on Windows: Copy install

2017-05-04 Thread jeff saremi
I have scoured the net for any hints on this. We have some prod machines where 
we're not able to run MSI installations.
Is it possible to copy Python2.7 from say c:\Python2.7 from one machine to 
another?
What other steps do we need beyond the following since these DONT work:
1. Copy all files

2. Add the new Python2.7\bin to PATH

3. Add C:\python2.7\Lib and C:\python2.7\Lib\site-packages to PYTHONPATH


thanks

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


[issue30276] import hashlib makes many programs slow

2017-05-04 Thread Bernhard M. Wiedemann

New submission from Bernhard M. Wiedemann:

Steps to Reproduce:
echo import hashlib > test.py
time python -m cProfile -s tottime test.py 2>&1 | head

Actual Results:
shows 27ms spent in hashlib.py


The problem goes away when dropping everything after line 133
in hashlib.py

see also issue 21288

--
assignee: christian.heimes
components: Library (Lib), SSL
messages: 293039
nosy: bmwiedemann, christian.heimes
priority: normal
severity: normal
status: open
title: import hashlib makes many programs slow
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



Re: Elegant way to merge dicts without overwriting keys?

2017-05-04 Thread MRAB

On 2017-05-05 02:23, Malcolm Greene wrote:

I have a bunch of pickled dicts I would like to merge. I only want to
merge unique keys but I want to track the keys that are duplicated
across dicts. Is there a newer dict-like data structure that is fine
tuned to that use case?
Short of an optimized data structure, my plan is to convert dict keys to
sets and compare these sets to determine which keys are unique and can
be merged and which keys are dupes and should be tracked in that manner.
At a high level, does this sound like a reasonable approach?
Thank you,
Malcolm


(Assuming Python 3.)

Suppose you have a number of dicts:

dict_1
dict_2
dict_3

Collect all of their keys into a list:

all_keys = list(dict_1) + list(dict_2) + list(dict_3)

How many times does each of the keys occur?

from collections import Counter
key_count = Counter(all_keys)

Which keys are unique?

unique_keys = [key for key in all_keys if key_count[key] == 1]
--
https://mail.python.org/mailman/listinfo/python-list


Re: os.getlogin() Error

2017-05-04 Thread Chris Angelico
On Fri, May 5, 2017 at 12:05 PM, Wildman via Python-list
 wrote:
> On Fri, 05 May 2017 09:58:02 +1000, Chris Angelico wrote:
>
>> On Fri, May 5, 2017 at 9:50 AM, Wildman via Python-list
>>  wrote:
>>> I'm afraid that won't work.  The user environment is different
>>> than root.  A different set of variables.  However you have
>>> given me a possible workaround.  You can't create a variable
>>> for root unless you are root so that approach is out.  But
>>> it might be possible to create the variable for the user
>>> and access it as root.  I don't have a lot of experience
>>> using os.environ, but I am going to at it closer.
>>
>> When you start a subprocess, it inherits your environment. So you can
>> create an environment variable for yourself, then start the other
>> process.
>
> I solved this problem by passing the user name to the second
> instance as a command line argument.  Works perfectly.  It
> escapes me why I didn't think of this sooner.  I solved the
> os.login problem by not using os.login, since I no longer
> need it. :-)

That works too!

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


Re: os.getlogin() Error

2017-05-04 Thread Wildman via Python-list
On Fri, 05 May 2017 09:58:02 +1000, Chris Angelico wrote:

> On Fri, May 5, 2017 at 9:50 AM, Wildman via Python-list
>  wrote:
>> I'm afraid that won't work.  The user environment is different
>> than root.  A different set of variables.  However you have
>> given me a possible workaround.  You can't create a variable
>> for root unless you are root so that approach is out.  But
>> it might be possible to create the variable for the user
>> and access it as root.  I don't have a lot of experience
>> using os.environ, but I am going to at it closer.
> 
> When you start a subprocess, it inherits your environment. So you can
> create an environment variable for yourself, then start the other
> process.

I solved this problem by passing the user name to the second
instance as a command line argument.  Works perfectly.  It
escapes me why I didn't think of this sooner.  I solved the
os.login problem by not using os.login, since I no longer
need it. :-)

> But read Cameron's cautionary notes and basically just don't do this.
> 
> ChrisA

It has been my experience that Linux users tend to be a little
more conscious of security matters and know what the implications
are when doing anything as root.  I expect the user will know the
risks if they choose to restart the program as root.  I believe
in user choice.

Thanks again for your replies.

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30172] test_tools takes longer than 5 minutes on some buildbots

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

I modified regrtest to log the system load: bpo-30263.

> On x86-64 El Capitan 3.x buildbot, test_tools takes longer than 5 minutes, 
> whereas the overall test suite took 31 min. Is someone wrong in test_tools?

On this buildbot which has 2 CPUs, the system load starts at 3.33, but goes up 
35.40:

0:04:48 load avg: 35.40 [ 41/405] test_tokenize passed (257 sec) -- running: 
test_lib2to3 (171 sec)

The system load is between 3.88 and 17.47 while test_tools is running.

running: test_multiprocessing_spawn (158 sec), test_tools (30 sec)
running: test_multiprocessing_spawn (188 sec), test_tools (60 sec)
running: test_multiprocessing_spawn (218 sec), test_tools (90 sec)
0:27:38 load avg: 4.04 [380/405] test_multiprocessing_spawn passed (247 sec) -- 
running: test_tools (120 sec)
0:27:39 load avg: 4.04 [381/405] test_telnetlib passed -- running: test_tools 
(121 sec)
0:27:43 load avg: 3.88 [382/405] test_dis passed -- running: test_tools (125 
sec)
0:27:44 load avg: 3.88 [383/405] test_script_helper passed -- running: 
test_tools (126 sec)
0:27:45 load avg: 3.88 [384/405] test_glob passed -- running: test_tools (127 
sec)
0:27:46 load avg: 4.21 [385/405] test_ensurepip passed -- running: test_tools 
(128 sec)
0:27:51 load avg: 4.59 [386/405] test_descr passed -- running: test_tools (133 
sec)
0:27:52 load avg: 4.59 [387/405] test_sax passed -- running: test_tools (134 
sec)
0:27:53 load avg: 4.59 [388/405] test_unicode_file_functions passed -- running: 
test_tools (135 sec)
0:27:54 load avg: 4.59 [389/405] test_xml_dom_minicompat passed -- running: 
test_tools (136 sec)
0:27:57 load avg: 4.54 [390/405] test___all__ passed -- running: test_tools 
(139 sec)
0:27:58 load avg: 4.54 [391/405] test_grammar passed -- running: test_tools 
(140 sec)
0:27:59 load avg: 4.54 [392/405] test_unpack passed -- running: test_tools (141 
sec)
0:28:17 load avg: 4.48 [393/405] test_weakref passed -- running: test_tools 
(159 sec)
0:28:19 load avg: 4.48 [394/405] test_parser passed -- running: test_tools (160 
sec)
0:28:25 load avg: 4.52 [395/405] test_difflib passed -- running: test_tools 
(167 sec)
0:28:26 load avg: 4.52 [396/405] test_compare passed -- running: test_tools 
(167 sec)
0:28:47 load avg: 9.68 [397/405] test_long passed -- running: test_tools (189 
sec)
0:28:48 load avg: 9.68 [398/405] test_mailcap passed -- running: test_tools 
(190 sec)
0:28:49 load avg: 9.68 [399/405] test_rlcompleter passed -- running: test_tools 
(191 sec)
running: test_pickle (30 sec), test_tools (221 sec)
0:29:38 load avg: 17.47 [400/405] test_pickle passed (49 sec) -- running: 
test_tools (240 sec)
0:29:49 load avg: 14.94 [401/405] test_nntplib passed -- running: test_tools 
(251 sec)
0:29:50 load avg: 14.94 [402/405] test_with passed -- running: test_tools (252 
sec)
0:29:52 load avg: 14.22 [403/405] test_enum passed -- running: test_tools (254 
sec)
0:29:55 load avg: 14.22 [404/405] test_source_encoding passed -- running: 
test_tools (257 sec)
running: test_tools (287 sec)
running: test_tools (317 sec)
0:30:58 load avg: 5.59 [405/405] test_tools passed (319 sec)


Is it ok to have such system load? Is there something wrong on this buildbot?

--

___
Python tracker 

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



Re: Elegant way to merge dicts without overwriting keys?

2017-05-04 Thread Skip Montanaro
On Thu, May 4, 2017 at 8:23 PM, Malcolm Greene  wrote:
> I have a bunch of pickled dicts I would like to merge. I only want to
> merge unique keys but I want to track the keys that are duplicated
> across dicts. Is there a newer dict-like data structure that is fine
> tuned to that use case?

There might be, but I don't keep a close enough eye on things to know.
It's simple enough to just subtract one set of keys from the other.
Simple example:

>>> a = dict(zip(range(0,10), string.lowercase))
>>> a
{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h', 8: 'i', 9: 'j'}
>>> b = dict(zip(range(5,15), string.uppercase))
>>> a
{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h', 8: 'i', 9: 'j'}
>>> b
{5: 'A', 6: 'B', 7: 'C', 8: 'D', 9: 'E', 10: 'F', 11: 'G', 12: 'H',
13: 'I', 14: 'J'}
>>> set(b) - set(a)
set([10, 11, 12, 13, 14])
>>> for key in set(b) - set(a):
...   a[key] = b[key]
...
>>> a
{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h', 8:
'i', 9: 'j', 10: 'F', 11: 'G', 12: 'H', 13: 'I', 14: 'J'}

Capture the logic in a function and you're good to go.

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


[issue30231] test_imaplib needs a TLS server accepting self-signed certificates

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

If no one speak up to propose a fix for the two skipped tests before a deadline 
of two weeks, I will removed them, apply:
https://github.com/python/cpython/pull/1419

--

___
Python tracker 

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



Best practice tips for sizing thread/process pools and concurrent futures max_workers?

2017-05-04 Thread Malcolm Greene
Looking for best practice tips on how to size thread/process pools or
max workers with the concurrent futures module. Are there specific
heuristics that can be applied or is this more a manual tuning process
based on the run time behavior of a script and the nuances of one's
environment? Are there any 3rd party libraries that monitor CPU/core
and memory utilization to dynamically tune these values based on
system capacity?
Thank you,
Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30255] test_xml_etree: python: Objects/sliceobject.c:176: _PySlice_AdjustIndices: Assertion `step >= -PY_SSIZE_T_MAX' failed.

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

> It's very strange because I expect either a crash: regrtest stops with no 
> more output, or a report of the crash. But no, regrtest displays the summary 
> as everything was fine...

It was a bug in regrtest: now fixed by bpo-30258.

--

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Wildman via Python-list
On Fri, 05 May 2017 09:00:58 +1000, Cameron Simpson wrote:

> On 04May2017 15:03, Wildman  wrote:
> 
>>The program installs using the Debian package system (.deb) and an
>>entry is created in the Applications Menu.  The strange thing is
>>that the crash only occurs when the program is run from the menu.
>>If I open a terminal and run the program from there, the program
>>runs fine.
> 
> And this supports that.
> 
> getlogin is not magic, and can be overused. The Python docs say "Return the 
> name of the user logged in on the controlling terminal of the process." 
> Clearly 
> that will fail.
> 
> When you start from a terminal, your command will have that as its 
> controlling 
> terminal unless it has gone out of its way not to. When you start from a 
> menu, 
> usually that menu system will not be associated with a terminal. In this case 
> you need to fall back on other methods of figuring out "who is logged in".

What I don't understand is why the program will run from the menu
on some Linux distros and not others.  I might need to take a
closer look at the structure of the .desktop file used to launch
my program.  Thanks.

> You should also _minimise_ the time and work your program does as root. Along 
> the lines of:
> 
>   ... program invoked setuid ...
>   look up os.getuid() to find the uid of the invoker
>   read as little as possible of the privileged info (i.e. shadow) as required
>   os.setuid() BACK TO THE ORIGINAL USER SO YOU ARE NO LONGER ROOT
>   ... do everything else ...

This is interesting.  Will do some experimenting.

> Part of your problem is that "who is the currently logged in user" is a 
> nebulous idea. Supposing you were to address the lack of controlling terminal 
> by seeing who is logged into the console. That is a little trusting. 
> Supposing 
> _you_ are logged into the console, running X11. And while so, _I_ ssh into 
> your 
> machine and run your program without a controlling terminal. Then your 
> program 
> will _mistakenly_ presume the logged in user is _you_ (because, after all, 
> you're logged in), and report _your_ information to _me_.
> 
> For all that setuid programs have their own security issues, at least they 
> _know_ who they were invoked by from os.getuid(), without playing insecure 
> guessing games around "who is logged in". Because the latter is not 
> equivalent 
> to "whose information should I access?"
> 
> I hope this points a way forward.
> 
> Personally I would usually resist accessing information not available as the 
> user, and avoid the need to run as root at all.
> 
> Cheers,
> Cameron Simpson 

I appreciate the advice and will consider it.

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

Jeremy Kloth: "I'm not in the position to be able to check this possibility, 
ATM, but it is possible that other things have also changed since this was 
commited 5 years ago."

I expect that many bugs have been fixed in virtualenv and venv modules, so 
maybe bpo-15366 was fixed indirectly?

It would be nice if you can tests on your side, since I'm not confident in my 
own tests :-)

I modified the build system of Python 2.7, 3.5, 3.6 and master (3.7). So you 
can pick any of these branches to run your test :-) I'm not sure that the bug 
affected or can affect Python 2.7.

--

___
Python tracker 

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



Elegant way to merge dicts without overwriting keys?

2017-05-04 Thread Malcolm Greene
I have a bunch of pickled dicts I would like to merge. I only want to
merge unique keys but I want to track the keys that are duplicated
across dicts. Is there a newer dict-like data structure that is fine
tuned to that use case?
Short of an optimized data structure, my plan is to convert dict keys to
sets and compare these sets to determine which keys are unique and can
be merged and which keys are dupes and should be tracked in that manner.
At a high level, does this sound like a reasonable approach?
Thank you,
Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

I modified Python 2.7, 3.5, 3.6 and master (3.7). I prefer to keep the issue 
open at least one week in a regression is found, like issue #30273 (this one 
should already be fixed).

Maybe the devguide should be updated too?

--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 8a19eb24c97ef43e9fc7d45af180334ac8093545 by Victor Stinner in 
branch '2.7':
bpo-23404: make touch becomes make regen-all (#1466)
https://github.com/python/cpython/commit/8a19eb24c97ef43e9fc7d45af180334ac8093545


--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1565

___
Python tracker 

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



[issue30275] pickle doesn't work in compile/exec

2017-05-04 Thread Jeff Zhang

New submission from Jeff Zhang:

I want to use pickle in compile/exec, but it doesn't work for me. It only works 
when I use the global namespace. But I don't want to use global namespace, is 
there any way for that ? Thanks

>>> a = compile("def f():\n\t'hello'\nimport pickle\npickle.dumps(f)", 
>>> "", "exec")
>>> exec(a)# works
>>> exec(a, {})# fails  
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in 
_pickle.PicklingError: Can't pickle : it's not the 
same object as __main__.f
>>> exec(a, {'__name__': '__main__'})   # fails too
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in 
_pickle.PicklingError: Can't pickle : it's not the 
same object as __main__.f

--
components: Library (Lib)
messages: 293032
nosy: Jeff Zhang
priority: normal
severity: normal
status: open
title: pickle doesn't work in compile/exec
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset ab6b962ef241be97536573d7490ce1cfc74fde18 by Victor Stinner in 
branch '3.5':
bpo-23404: make touch becomes make regen-all (#1405) (#1461) (#1465)
https://github.com/python/cpython/commit/ab6b962ef241be97536573d7490ce1cfc74fde18


--

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset ab6b962ef241be97536573d7490ce1cfc74fde18 by Victor Stinner in 
branch '3.5':
bpo-23404: make touch becomes make regen-all (#1405) (#1461) (#1465)
https://github.com/python/cpython/commit/ab6b962ef241be97536573d7490ce1cfc74fde18


--

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

> The change to sysconfig *may* be a regression wrt bpo-15366.

Hum, I'm still able to create a venv and install coverage in the venv after my 
commit b109a1d3360fc4bb87b9887264e3634632d392ca, whereas this commit basically 
reverts the bpo-15366 fix.

--

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Chris Angelico
On Fri, May 5, 2017 at 9:50 AM, Wildman via Python-list
 wrote:
> I'm afraid that won't work.  The user environment is different
> than root.  A different set of variables.  However you have
> given me a possible workaround.  You can't create a variable
> for root unless you are root so that approach is out.  But
> it might be possible to create the variable for the user
> and access it as root.  I don't have a lot of experience
> using os.environ, but I am going to at it closer.

When you start a subprocess, it inherits your environment. So you can
create an environment variable for yourself, then start the other
process.

But read Cameron's cautionary notes and basically just don't do this.

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


[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1563

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Wildman via Python-list
On Fri, 05 May 2017 08:31:15 +1000, Chris Angelico wrote:

> On Fri, May 5, 2017 at 8:18 AM, Wildman via Python-list
>  wrote:
>> I am using pkexec to restart so $SUDO_USER is not set.  For some
>> reason sudo, su and su-to-root will freeze the first instance of
>> the program and not let it close until the second instance closes.
>> I have tried every method I can find to launch them and pkexec
>> is the only one that works correctly.
>>
>> Thanks for the reply.
> 
> Ah, okay. I wonder if you can do the same thing? Just before you
> invoke pkexec, create an environment variable with the current user
> credentials. Then pkexec back to yourself, and look in the
> environment.
> 
> ChrisA

I'm afraid that won't work.  The user environment is different
than root.  A different set of variables.  However you have
given me a possible workaround.  You can't create a variable
for root unless you are root so that approach is out.  But
it might be possible to create the variable for the user
and access it as root.  I don't have a lot of experience
using os.environ, but I am going to at it closer.

Thanks.

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1564

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Cameron Simpson

On 04May2017 15:03, Wildman  wrote:

I tried testing on Mint and Ubuntu and the program would crash.  The
GUI would appear briefly and disappear.  On Ubuntu a crash report was
created so I was able to figure out what was going on.  It had the
traceback and showed that os.getlogin threw an error.  This is from
the crash report:

PythonArgs: ['/opt/linfo-tk/linfo-tk.py']
Traceback:
Traceback (most recent call last):
  File "/opt/linfo-tk/linfo-tk.py", line 1685, in 
app = Window(root)
  File "/opt/linfo-tk/linfo-tk.py", line 1393, in __init__
txt = function()
  File "/opt/linfo-tk/linfo-tk.py", line 316, in userinfo
user = os.getlogin()
OSError: [Errno 25] Inappropriate ioctl for device


This usually means that the program does not have a controlling terminal.


The program installs using the Debian package system (.deb) and an
entry is created in the Applications Menu.  The strange thing is
that the crash only occurs when the program is run from the menu.
If I open a terminal and run the program from there, the program
runs fine.


And this supports that.

getlogin is not magic, and can be overused. The Python docs say "Return the 
name of the user logged in on the controlling terminal of the process." Clearly 
that will fail.


When you start from a terminal, your command will have that as its controlling 
terminal unless it has gone out of its way not to. When you start from a menu, 
usually that menu system will not be associated with a terminal. In this case 
you need to fall back on other methods of figuring out "who is logged in".



I found a little info on the web about this but it was not clear
whether it is a bug in Linux or a bug in the os module.  I also
found a couple of work-arounds but neither of them will work for
my purposes.

   user = pwd.getpwuid(os.getuid())[0]
   user = getpass.getuser()

I will try to explain...
The program reports system information based on the user's name.
Things such as passwd, groups and shadow info.  However, the
program must have elevated privileges to get the shadow info so
the program has the option to 'restart as root' so the shadow
information will be obtainable.

If the program is restarting as root, the work-arounds report
the user as 'root'.


The "shadow" information is normally concealed for good reason.  I appreciate 
that you're trying to only report that information for the current user, but 
you should consider whether you should report it at all.


Personally I would be reluctant to write a program that "restarts as root"; it 
feels like a tool where a bug would lead easily to privilege escalation - that 
the calling user (not root, and from root's point of view untrustworthy) might 
get it to perform extra tasks beyond your plan AS ROOT. Risky.



Is there a way to get the actual user name or is there a fix
or a better work-around for the os.getlogin() function?


The standard way is not to "restart as root", but to write a setuid program. It 
still has all the pitfalls of any program running as root (the change for bugs 
to let the calling user do something they should not be allowed to do), but you 
can examine the value from os.getuid(): it will be the _calling_ user, while 
os.geteuid() will be the effective user (root in your case). Then the 
workaround will be effective.


You should also _minimise_ the time and work your program does as root. Along 
the lines of:


 ... program invoked setuid ...
 look up os.getuid() to find the uid of the invoker
 read as little as possible of the privileged info (i.e. shadow) as required
 os.setuid() BACK TO THE ORIGINAL USER SO YOU ARE NO LONGER ROOT
 ... do everything else ...

Part of your problem is that "who is the currently logged in user" is a 
nebulous idea. Supposing you were to address the lack of controlling terminal 
by seeing who is logged into the console. That is a little trusting. Supposing 
_you_ are logged into the console, running X11. And while so, _I_ ssh into your 
machine and run your program without a controlling terminal. Then your program 
will _mistakenly_ presume the logged in user is _you_ (because, after all, 
you're logged in), and report _your_ information to _me_.


For all that setuid programs have their own security issues, at least they 
_know_ who they were invoked by from os.getuid(), without playing insecure 
guessing games around "who is logged in". Because the latter is not equivalent 
to "whose information should I access?"


I hope this points a way forward.

Personally I would usually resist accessing information not available as the 
user, and avoid the need to run as root at all.


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


[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread Jeremy Kloth

Jeremy Kloth added the comment:

The change to sysconfig *may* be a regression wrt bpo-15366.

I'm not in the position to be able to check this possibility, ATM, but it is 
possible that other things have also changed since this was commited 5 years 
ago.

--
nosy: +jkloth

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 9d02f562961efd12d3c8317a10916db7f77330cc by Victor Stinner in 
branch '3.6':
[3.6] bpo-23404: make touch becomes make regen-all (#1405) (#1461)
https://github.com/python/cpython/commit/9d02f562961efd12d3c8317a10916db7f77330cc


--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 9d02f562961efd12d3c8317a10916db7f77330cc by Victor Stinner in 
branch '3.6':
[3.6] bpo-23404: make touch becomes make regen-all (#1405) (#1461)
https://github.com/python/cpython/commit/9d02f562961efd12d3c8317a10916db7f77330cc


--

___
Python tracker 

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



[issue29094] Regression in zipfile writing in 2.7.13

2017-05-04 Thread Thomas Wouters

Thomas Wouters added the comment:

Well, what should the zipfile module do when you open a broken zipfile for 
appending in the first place? :) There are many ways in which it could be 
broken. I don't think a zipfile with incorrect offsets should be treated any 
differently.

(I don't know *how* the zipfile module should treat broken zipfiles, and I 
don't know how it treats them now -- but I think the most important thing is 
consistency and documenting the choice :P)

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Interesting  dir(list.append) and the IDLE completion box show 
__text_signature__.  dir(list) and the box do not.

--

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Chris Angelico
On Fri, May 5, 2017 at 8:18 AM, Wildman via Python-list
 wrote:
> I am using pkexec to restart so $SUDO_USER is not set.  For some
> reason sudo, su and su-to-root will freeze the first instance of
> the program and not let it close until the second instance closes.
> I have tried every method I can find to launch them and pkexec
> is the only one that works correctly.
>
> Thanks for the reply.

Ah, okay. I wonder if you can do the same thing? Just before you
invoke pkexec, create an environment variable with the current user
credentials. Then pkexec back to yourself, and look in the
environment.

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


[issue30270] Remove sqlite3.Cache display method

2017-05-04 Thread Brett Cannon

Brett Cannon added the comment:

How long has the method been there? And does it hurt anything for it to be 
exposed? Removing it at this point may break code if it predates Python 3.7.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue30274] Make importlib.abc.ExtensionFileLoader.__init__() documentation match code

2017-05-04 Thread Brett Cannon

New submission from Brett Cannon:

https://docs.python.org/3/library/importlib.html#importlib.machinery.ExtensionFileLoader
 says "fullname, path" for __init__(), but 
https://github.com/python/cpython/blob/647c3d381e67490e82cdbbe6c96e46d5e1628ce2/Lib/importlib/_bootstrap_external.py#L909
 says "name, path". While I would much rather change the parameter name to 
match the rest of the module, I don't think I'm comfortable with the 
backwards-compatibility breakage over just a single parameter name (although 
chances are no one will notice in either direction as everyone probably passes 
by position).

--
assignee: docs@python
components: Documentation
messages: 293022
nosy: brett.cannon, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Make importlib.abc.ExtensionFileLoader.__init__() documentation match 
code

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Wildman via Python-list
On Fri, 05 May 2017 07:46:32 +1000, Chris Angelico wrote:

> On Fri, May 5, 2017 at 6:03 AM, Wildman via Python-list
>  wrote:
>> I will try to explain...
>> The program reports system information based on the user's name.
>> Things such as passwd, groups and shadow info.  However, the
>> program must have elevated privileges to get the shadow info so
>> the program has the option to 'restart as root' so the shadow
>> information will be obtainable.
>>
>> If the program is restarting as root, the work-arounds report
>> the user as 'root'.  Then the system information for passwd,
>> groups and shadow will be reported for 'root' and not the
>> user that ran the program.  The actual user name that ran
>> the program is needed for the program to report correct
>> information.
>>
>> It seems that only os.getlogin() reports the true user name no
>> matter if the program is run as a normal user or restarted as
>> root.
>>
>> Is there a way to get the actual user name or is there a fix
>> or a better work-around for the os.getlogin() function?
> 
> That depends on exactly how the program "restarts as root". One very
> common way to do this is to invoke itself through sudo(1). If that's
> how you're flipping yourself to root, check os.environ["SUDO_USER"] or
> os.environ["SUDO_UID"], both of which will be set by sudo before it
> invokes the program.
> 
> ChrisA

I am using pkexec to restart so $SUDO_USER is not set.  For some
reason sudo, su and su-to-root will freeze the first instance of
the program and not let it close until the second instance closes.
I have tried every method I can find to launch them and pkexec
is the only one that works correctly.

Thanks for the reply.

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30085] Discourage operator.__dunder__ functions

2017-05-04 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
stage:  -> commit review
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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

> What if the third-party parser don't use prepare_input_source()? It can use 
> more efficient way if pass just a file name.

About "third-party parsers": I have no idea of what are these parsers. It seems 
like Jython uses provides a parser. But I'm not interested to test Jython, 
sorry!

> Wouldn't be better to move your code into the parser's method parse()? If a 
> file is opened inside the parse() method and is not exposed outside, that 
> method should close it.

I wrote a first patch putting the try/except into expatparser code, but then I 
found a second parser with a parse() method: IncrementalParser. In fact, the 
expat parser inherits from IncrementalParser. So I only modified 
IncrementalParser, and IncrementalParser calls the abstract method close(). So 
any parser implemented on top of IncrementalParser should get the fix for free.

My 3rd attempt (patch IncrementalParser.parse()) changes less code and IMHO is 
less error-prone.

Now, *in practice*, only the expat parser is used in CPython, and according to 
unit tests, my fix closes the file, so the bug is fixed!

--

___
Python tracker 

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



Re: os.getlogin() Error

2017-05-04 Thread Chris Angelico
On Fri, May 5, 2017 at 6:03 AM, Wildman via Python-list
 wrote:
> I will try to explain...
> The program reports system information based on the user's name.
> Things such as passwd, groups and shadow info.  However, the
> program must have elevated privileges to get the shadow info so
> the program has the option to 'restart as root' so the shadow
> information will be obtainable.
>
> If the program is restarting as root, the work-arounds report
> the user as 'root'.  Then the system information for passwd,
> groups and shadow will be reported for 'root' and not the
> user that ran the program.  The actual user name that ran
> the program is needed for the program to report correct
> information.
>
> It seems that only os.getlogin() reports the true user name no
> matter if the program is run as a normal user or restarted as
> root.
>
> Is there a way to get the actual user name or is there a fix
> or a better work-around for the os.getlogin() function?

That depends on exactly how the program "restarts as root". One very
common way to do this is to invoke itself through sudo(1). If that's
how you're flipping yourself to root, check os.environ["SUDO_USER"] or
os.environ["SUDO_UID"], both of which will be set by sudo before it
invokes the program.

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


[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>>> list.__text_signature__
'(iterable=(), /)'

But IDLE shouldn't use __text_signature__ directly, it should use the inspect 
module.

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

(I presume'ordinal' meant 'ordinary'.)  I don't know where signature finds the 
info on built-in type objects   Methods like .append have .__text_signature__.  
List does not, and list.__call__.__text_signature is the generic '($self, /, 
*args, **kwargs)'.  That signature finds it somewhere is a reason for the 
switch. There is no longer a signature in the first lines of the docstring. So 
currently, 'list(' only displays "Built-in mutable sequence."

Louie, I verified that for python-coded classes, signature itself gets the info 
from the __init__ method, so we don't need 'fob = ob.__init__' for python 
classes either.

--

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset b109a1d3360fc4bb87b9887264e3634632d392ca by Victor Stinner in 
branch 'master':
bpo-30273: Update sysconfig (#1464)
https://github.com/python/cpython/commit/b109a1d3360fc4bb87b9887264e3634632d392ca


--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset b109a1d3360fc4bb87b9887264e3634632d392ca by Victor Stinner in 
branch 'master':
bpo-30273: Update sysconfig (#1464)
https://github.com/python/cpython/commit/b109a1d3360fc4bb87b9887264e3634632d392ca


--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1562

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1561

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

> get_config_var('AST_H_DIR')

Oh, I see. My commit a5c62a8e9f0de6c4133825a5710984a3cd5e102b removed multiple 
variables from Makefile.pre.in to simplify it, but I didn't notice that some of 
them (only AST_H_DIR?) were used outside Makefile.pre.in. I completely forgot 
the evil sysconfig (evil in term of backward compatibility...).

I removed the following variables from Makefile.pre.in:

* @GENERATED_COMMENT@
* ASDLGEN
* ASDLGEN_FILES
* AST_ASDL
* AST_C
* AST_C_DIR
* AST_H
* AST_H_DIR
* GRAMMAR_C
* GRAMMAR_H
* GRAMMAR_INPUT
* OPCODETARGETGEN
* OPCODETARGETGEN_FILES
* OPCODETARGETS_H
* OPCODE_H
* OPCODE_H_DIR
* OPCODE_H_GEN
* OPCODE_H_SCRIPT
* PYTHON_FOR_GEN (renamed to PYTHON_FOR_REGEN)

I didn't see the point of the AST_H_DIR variable since its value was hardcoded 
to "Include" and it was only used to regenerate generated files related to AST.

I don't understand why sysconfig chose this specific variable to get the 
"Include" subdirectory!?

I'm writing a fix to replace AST_H_DIR variable with "Include".

--

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

To reproduce the bug, build the master branch of Python and then run:

./python -m venv venv
./venv/bin/python -m pip install -U coverage

Or just:

$ ./venv/bin/python -c 'from distutils import sysconfig; 
print(sysconfig.get_python_inc())'
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/haypo/prog/python/master/Lib/distutils/sysconfig.py", line 100, 
in get_python_inc
incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR'))
  File "/home/haypo/prog/python/master/Lib/posixpath.py", line 92, in join
genericpath._check_arg_types('join', a, *p)
  File "/home/haypo/prog/python/master/Lib/genericpath.py", line 149, in 
_check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, yes, __new__ and __init__ differ from ordinal methods. They don't have 
docstrings generated by Argument Clinic. But list itself as a callable have 
correct signature.

>>> inspect.signature(list)


--

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2017-05-04 Thread STINNER Victor

New submission from STINNER Victor:

Bug reported by Antoine Pitrou on the python-committers mailing list.

According to Brett Canon, the first failure was:
https://travis-ci.org/python/cpython/jobs/228409786

And the regression is related to my commit 
a5c62a8e9f0de6c4133825a5710984a3cd5e102b: bpo-23404.

Collecting coverage
  Downloading coverage-4.3.4.tar.gz (361kB)
�Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/coverage.egg-info
writing pip-egg-info/coverage.egg-info/PKG-INFO
writing dependency_links to
pip-egg-info/coverage.egg-info/dependency_links.txt
writing entry points to pip-egg-info/coverage.egg-info/entry_points.txt
writing top-level names to pip-egg-info/coverage.egg-info/top_level.txt
writing manifest file 'pip-egg-info/coverage.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found

Traceback (most recent call last):
  File "", line 1, in 
  File "/tmp/pip-build-ewtgqc2r/coverage/setup.py", line 204, in

main()
  File "/tmp/pip-build-ewtgqc2r/coverage/setup.py", line 194, in main
setup(**setup_args)
  File "/home/travis/build/python/cpython/Lib/distutils/core.py",
line 148, in setup
dist.run_commands()
  File "/home/travis/build/python/cpython/Lib/distutils/dist.py",
line 955, in run_commands
self.run_command(cmd)
  File "/home/travis/build/python/cpython/Lib/distutils/dist.py",
line 974, in run_command
cmd_obj.run()
  File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 279, in run
self.find_sources()
  File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 306, in find_sources
mm.run()
  File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 533, in run
self.add_defaults()
  File
"/home/travis/build/python/cpython/venv/lib/python3.7/site-packages/setuptools/command/egg_info.py",
line 562, in add_defaults
sdist.add_defaults(self)
  File
"/home/travis/build/python/cpython/Lib/distutils/command/sdist.py", line
228, in add_defaults
self._add_defaults_ext()
  File
"/home/travis/build/python/cpython/Lib/distutils/command/sdist.py", line
311, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
  File "/home/travis/build/python/cpython/Lib/distutils/cmd.py",
line 299, in get_finalized_command
cmd_obj.ensure_finalized()
  File "/home/travis/build/python/cpython/Lib/distutils/cmd.py",
line 107, in ensure_finalized
self.finalize_options()
  File
"/home/travis/build/python/cpython/Lib/distutils/command/build_ext.py",
line 150, in finalize_options
py_include = sysconfig.get_python_inc()
  File
"/home/travis/build/python/cpython/Lib/distutils/sysconfig.py", line
100, in get_python_inc
incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR'))
  File "/home/travis/build/python/cpython/Lib/posixpath.py", line
92, in join
genericpath._check_arg_types('join', a, *p)
  File "/home/travis/build/python/cpython/Lib/genericpath.py", line
149, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'


�Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-build-ewtgqc2r/coverage/�

--
components: Build, Tests
messages: 293014
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: The coverage job is broken: distutils build_ext fails on None
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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

help(object.__init__) and help(list.__init__) have exactly the same output.

--

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

list.__new__ is inherited from object. Look at list.__init__.

--

___
Python tracker 

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



os.getlogin() Error

2017-05-04 Thread Wildman via Python-list
I wrote a Linux only GUI program using Tk that reports various system
information using a tabbed Notebook.  I have tested the program on
Debian, SoldyX and MX-15 and the program runs perfectly.

I tried testing on Mint and Ubuntu and the program would crash.  The
GUI would appear briefly and disappear.  On Ubuntu a crash report was
created so I was able to figure out what was going on.  It had the
traceback and showed that os.getlogin threw an error.  This is from
the crash report:

PythonArgs: ['/opt/linfo-tk/linfo-tk.py']
Traceback:
 Traceback (most recent call last):
   File "/opt/linfo-tk/linfo-tk.py", line 1685, in 
 app = Window(root)
   File "/opt/linfo-tk/linfo-tk.py", line 1393, in __init__
 txt = function()
   File "/opt/linfo-tk/linfo-tk.py", line 316, in userinfo
 user = os.getlogin()
 OSError: [Errno 25] Inappropriate ioctl for device

The program installs using the Debian package system (.deb) and an
entry is created in the Applications Menu.  The strange thing is
that the crash only occurs when the program is run from the menu.
If I open a terminal and run the program from there, the program
runs fine.

I found a little info on the web about this but it was not clear
whether it is a bug in Linux or a bug in the os module.  I also
found a couple of work-arounds but neither of them will work for
my purposes.

user = pwd.getpwuid(os.getuid())[0]
user = getpass.getuser()

I will try to explain...
The program reports system information based on the user's name.
Things such as passwd, groups and shadow info.  However, the
program must have elevated privileges to get the shadow info so
the program has the option to 'restart as root' so the shadow
information will be obtainable.

If the program is restarting as root, the work-arounds report
the user as 'root'.  Then the system information for passwd,
groups and shadow will be reported for 'root' and not the
user that ran the program.  The actual user name that ran
the program is needed for the program to report correct
information.

It seems that only os.getlogin() reports the true user name no
matter if the program is run as a normal user or restarted as
root.

Is there a way to get the actual user name or is there a fix
or a better work-around for the os.getlogin() function?

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

>>> help(list.__new__)
Help on built-in function __new__:

__new__(*args, **kwargs) method of builtins.type instance
Create and return a new object.  See help(type) for accurate signature.

'list.__new__(' currently pops up just the docstring.  I think adding (*args, 
**kwargs) on top of it does not hurt and maybe is a slight improvement, as it 
explains the second line a bit.  In any case, explicitly calling __new__ and 
__init__ is extremely rare, especially for beginners.

For rexep.sub, adding (repl, string, count=0) on top of "Return the string 
obtained by replacing the leftmost non-overlapping occurrences o..." is a pure 
win.  Wrapping the too-long docstring line is a separate matter.

--

___
Python tracker 

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



[issue30272] distutils.version.LooseVersion's compare raises exception in corner-case

2017-05-04 Thread Oliver Smith

Changes by Oliver Smith :


--
components: +Distutils
nosy: +dstufft, merwok
type:  -> behavior

___
Python tracker 

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



[issue30272] distutils.version.LooseVersion's compare raises exception in corner-case

2017-05-04 Thread Oliver Smith

New submission from Oliver Smith:

This should return True and not raise an exception:

>>> from distutils.version import LooseVersion
>>> LooseVersion("22.7-r1") < LooseVersion("22.7.3-r1")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/distutils/version.py", line 52, in __lt__
c = self._cmp(other)
  File "/usr/lib/python3.6/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
>>>

Tested with Python 3.6.1.

--
messages: 293009
nosy: ollieparanoid2
priority: normal
severity: normal
status: open
title: distutils.version.LooseVersion's compare raises exception in corner-case
versions: Python 3.6

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Yury Selivanov

Changes by Yury Selivanov :


--
nosy:  -yselivanov

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-05-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Let's back up.  The high-level specification for get_argspec is something like 
'Return information that will help programmers write a correct call."  The 
proposed implementation strategy is to combine signature info from signature 
(replacing getfullargspec) and the initial part of the callable docstring.

This goal and strategy mimic help(callable).  So we can use its output as a 
guide, but improve on it when we can and think we should.  This issue could be 
framed as 'catch up with help(callable)' which already switched to signature.

The test examples constitute a low-level specification by example.  As such, 
they should be discussed here before changing the code. Let's consider the ones 
you listed, using 'help(callable)' as a guide.

>>> help(range.__init__)
Help on wrapper_descriptor:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Not very helpful, but if one types 'range.__init__(', one currently sees the 
last line and should see the last two lines in the future.

However, the calltip for 'range(' should not be the above.  When 
type(__init__).__name__ == 'wrapper_descripter, the "fob = ob.__init__" 
replacement should not happen, at least not until we see a case where a 
wrapper_descripter has the real signature.  (Whether is it still needed for 
python-coded classes is a separate issue.)  I don't know if all built-in inits 

>>> help(list.append)
Help on method_descriptor:
append(self, object, /)
Append object to the end of the list.
>>> help([].append)
Help on built-in function append:
append(object, /) method of builtins.list instance
Append object to the end of the list.

The signature output is fine with me.  I want future calltips to include it, 
along with the docstring line.

The only issue is the ', /'.  If people can survive it presence in help output, 
ditto for calltips.  But whenever a signature string contains '/', we could 
add, between signature and docstring lines, the following.
"('/' marks preceding arguments as positional-only.)"  If we do this, the 
string should be a global '_positional = ...' so it can be used as-is for 
tests.  I am inclined to try this.

I want to leave the '/' in the signature because there have been multiple 
issues and forum questions about why the equivalent of [].append(object='a') 
does not work.  Now, some built-in parameters are positional-only, some 
keyword-only, and some both.  The hint should make this clear.

--

___
Python tracker 

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



[issue30264] [Windows] test_sax: Warning -- files was modified by test_sax

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What if the third-party parser don't use prepare_input_source()? It can use 
more efficient way if pass just a file name.

Wouldn't be better to move your code into the parser's method parse()? If a 
file is opened inside the parse() method and is not exposed outside, that 
method should close it.

--
components: +Library (Lib) -Tests
nosy: +eli.bendersky, scoder, serhiy.storchaka
stage:  -> patch review
type:  -> behavior

___
Python tracker 

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



[issue30271] Make sqlite3 statement cache optional

2017-05-04 Thread Aviv Palivoda

Changes by Aviv Palivoda :


--
pull_requests: +1560

___
Python tracker 

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



[issue30271] Make sqlite3 statement cache optional

2017-05-04 Thread Aviv Palivoda

New submission from Aviv Palivoda:

Currently the minimum size of the statement cache is 10. I suggest that it will 
be any value above 1 or no cache at all if the size is set to 0.

--
components: Extension Modules
messages: 293006
nosy: berker.peksag, ghaering, palaviv
priority: normal
severity: normal
status: open
title: Make sqlite3 statement cache optional
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



[issue18699] What is Future.running() for in PEP 3148 / concurrent.futures.Future?

2017-05-04 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests:  -1535

___
Python tracker 

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



[issue18669] curses.chgat() moves cursor, documentation says it shouldn't

2017-05-04 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1558

___
Python tracker 

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



[issue30270] Remove sqlite3.Cache display method

2017-05-04 Thread Aviv Palivoda

Changes by Aviv Palivoda :


--
pull_requests: +1559

___
Python tracker 

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



[issue30270] Remove sqlite3.Cache display method

2017-05-04 Thread Aviv Palivoda

New submission from Aviv Palivoda:

The display method is there for debugging and should not be in the released 
code.

--
components: Extension Modules
messages: 293005
nosy: berker.peksag, ghaering, palaviv
priority: normal
severity: normal
status: open
title: Remove sqlite3.Cache display method
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



[issue30267] Deprecate os.path.commonprefix

2017-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We shouldn't deprecate a function until add an alternative. There is a working 
alternative for paths, but commonprefix() is used in the wild for non-paths 
(for example in unittest.util). The problem is that there is no right place for 
this function. The string module is wrong place because commonprefix() supports 
not only strings. Perhaps the new seqtools module would be a right place.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Promiscuous ports under Linux

2017-05-04 Thread Grant Edwards
On 2017-05-04, Peter Pearson  wrote:

> I'm curious to survey all my LAN traffic in various ways, and it seems
> likely that I will see phenomena that I don't understand, and focussing
> in on those phenomena is likely to require more flexible filtering
> than Wireshark can provide.  I expect to leave this process running for
> maybe 24 hours at a stretch, maybe longer, with real-time alerts when
> interesting things occur.

You can libpcap (which is what wireshark uses on Linux) to deal with
the details of capturing the packets and do the analysis in Python.

> Maybe Wireshark can do everything I'll ever need to do, but it seems
> so complicated, and Python seems so simple . . .

I've been using pylibpcap for yonks, and have no complaints.

  https://sourceforge.net/projects/pylibpcap/

Another advantage of pylibpcap is that you can used it to read files
saved by wireshark or tcpdump.

-- 
Grant Edwards   grant.b.edwardsYow! Somewhere in DOWNTOWN
  at   BURBANK a prostitute is
  gmail.comOVERCOOKING a LAMB CHOP!!

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


[issue30269] [2.7] test_release_task_refs() of test_multiprocessing.py is unstable

2017-05-04 Thread STINNER Victor

New submission from STINNER Victor:

[2.7] test_release_task_refs() of test_multiprocessing.py fails randomly.

Example:

http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%202.7/builds/136/steps/test/logs/stdio

[116/401/1] test_multiprocessing
[77069 refs]
test test_multiprocessing failed -- Traceback (most recent call last):
  File 
"/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/test/test_multiprocessing.py",
 line 1293, in test_release_task_refs
self.assertEqual(set(wr() for wr in refs), {None})
AssertionError: Items in the first set but not the second:










Items in the second set but not the first:
None
(...)
Re-running test 'test_multiprocessing' in verbose mode
(...)
Ran 167 tests in 20.640s
OK (skipped=12)

--
components: Tests
messages: 293003
nosy: haypo
priority: normal
severity: normal
status: open
title: [2.7] test_release_task_refs() of test_multiprocessing.py is unstable
versions: Python 2.7

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

I started a thread on python-dev to ask if it's ok to backport the change to 
2.7, 3.5 and 3.6.

I started to backport the change to 3.6:
https://github.com/python/cpython/pull/1461

--

___
Python tracker 

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



[issue23404] 'make touch' does not work with git clones of the source repository

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1557

___
Python tracker 

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



[issue30171] Emit ResourceWarning in multiprocessing Queue destructor

2017-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The thread seems to be stopped when the Queue object is finalized:

# Send sentinel to the thread queue object when garbage collected
self._close = Finalize(
self, Queue._finalize_close,
[self._buffer, self._notempty],
exitpriority=10
)

I don't think the other resources (pipe, lock, semaphore) need explicit 
cleaning.

--
nosy: +pitrou

___
Python tracker 

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



[issue30108] test_site modifies sys.path

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset e81e355a8e4395680225e3f99859a1a29ecb by Victor Stinner in 
branch '2.7':
bpo-30108: Fix test_site setUpModule() (#1460)
https://github.com/python/cpython/commit/e81e355a8e4395680225e3f99859a1a29ecb


--

___
Python tracker 

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



[issue30108] test_site modifies sys.path

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1556

___
Python tracker 

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



Re: Promiscuous ports under Linux

2017-05-04 Thread Peter Pearson
On Thu, 04 May 2017 10:26:45 GMT, alister  wrote:
> On Wed, 03 May 2017 23:57:49 +, Peter Pearson wrote:
>
>> Cobbling together a minimalist ethernet-sniffing program, I was hoping
>> to use this simple mechanism for setting the socket to "promiscuous
>> mode" (to see all traffic going past, instead of just traffic addressed
>> to my machine):
>> 
>> s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
>> 
>> Unfortunately, it seems that that mechanism is available under Windows
>> but not under Linux.  Googling around for Linux equivalents, I found
>> only very contorted solutions, and concluded that maybe this lacuna
>> persists because Linux users find it convenient to invoke promiscuous
>> mode from the command line, instead:
>> 
>> $ sudo ip link set eth0 promisc on $ netstat -i# (Verify
>> that the P flag is set.)
>> 
>> This somehow fails: my sniffer continues to see only broadcasts,
>> but if I run dumpcap at the same time, dumpcap captures lots of traffic.
>> 
>> So my question is now two questions:
>> 
>>  . Is it true that going permiscuous under Linux must be somewhat ugly?
>>(It's OK if it is, I'll just copy the ugly code and get moving
>>again.)
>> 
>>  . Why doesn't the command-line "promisc on" work?  (Granted, this is
>>maybe a Linux question.)
>> 
>> Thanks.
>
> any particular reason why you wish to re-invent this particular wheel 
> when wireshark is freely available (& the de-facto tool of choice for 
> most network engineers)

I'm curious to survey all my LAN traffic in various ways, and it seems
likely that I will see phenomena that I don't understand, and focussing
in on those phenomena is likely to require more flexible filtering
than Wireshark can provide.  I expect to leave this process running for
maybe 24 hours at a stretch, maybe longer, with real-time alerts when
interesting things occur.

Maybe Wireshark can do everything I'll ever need to do, but it seems
so complicated, and Python seems so simple . . .

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30108] test_site modifies sys.path

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 78064387e5815633168a80dcdc1bd9aec4eff46a by Victor Stinner in 
branch '2.7':
bpo-30108: Restore sys.path in test_site (#1197) (#1459)
https://github.com/python/cpython/commit/78064387e5815633168a80dcdc1bd9aec4eff46a


--

___
Python tracker 

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



[issue30185] forkserver process should silence KeyboardInterrupt

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

> There is no forkserver in 2.7.

Oh right, it's specific to forkserver, ok ;-) Thank you for the fix.

--

___
Python tracker 

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



[issue30185] forkserver process should silence KeyboardInterrupt

2017-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

There is no forkserver in 2.7.

--

___
Python tracker 

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



[issue30268] Make mimetypes.guess_type accept path-like objects

2017-05-04 Thread ProgVal

New submission from ProgVal:

The documentation for mimetypes.guess_type says that it “guesses the type of a 
file based on its filename or URL”.

However, this function only accepts a string object, and not a bytes object:

>>> import os
>>> import mimetypes
>>> mimetypes.guess_type(os.listdir(os.fsencode('./'))[0])
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.7/mimetypes.py", line 291, in guess_type
return _db.guess_type(url, strict)
  File "/usr/lib/python3.7/mimetypes.py", line 116, in guess_type
scheme, url = urllib.parse.splittype(url)
  File "/usr/lib/python3.7/urllib/parse.py", line 924, in splittype
match = _typeprog.match(url)
TypeError: cannot use a string pattern on a bytes-like object

--
components: Library (Lib)
messages: 292995
nosy: Valentin.Lorentz
priority: normal
severity: normal
status: open
title: Make mimetypes.guess_type accept path-like objects

___
Python tracker 

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



[issue30185] forkserver process should silence KeyboardInterrupt

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

Python 2.7 isn't affected by this bug?

--

___
Python tracker 

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



Re: __getattribute__'s error is not available in __getattr__

2017-05-04 Thread Jason Maldonis
Thank you Ethan and Chris for the tips. I may be able to adapt that
decorator for my use cases -- I hadn't thought of using something like
that.   Ethan, I'll drop a note over at Python Ideas too with some details
about this.

Thanks for your help,
Jason

On Tue, May 2, 2017 at 9:47 PM, Chris Angelico  wrote:

> On Wed, May 3, 2017 at 12:37 PM, Ethan Furman  wrote:
> > Until then Chris' decorator is probably the easiest work around -- but
> you
> > should only catch AttributeError, not everything.
>
> It does. (Or rather, it catches only those exception(s) listed as
> parameters.) Any other exceptions pass through unchanged.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30267] Deprecate os.path.commonprefix

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

Ned Batchelder wrote an article about this function in 2010 :-)

https://nedbatchelder.com/blog/201003/whats_the_point_of_ospathcommonprefix.html

"""
The docs helpfully include the warning:

Note that this may return invalid paths because it works a character at a 
time.

But it should say:

This function is in the wrong place, and has nothing to do with paths, 
don't use it if you are interested in file paths!
"""

--
nosy: +haypo, nedbat

___
Python tracker 

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



[issue30108] test_site modifies sys.path

2017-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1555

___
Python tracker 

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



[issue30267] Deprecate os.path.commonprefix

2017-05-04 Thread ProgVal

New submission from ProgVal:

The function os.path.commonprefix computes the longest prefix of strings (any 
iterable, actually), regardless of their meaning as paths.

I do not see any reason to use this function for paths, and keeping it in the 
os.path module makes it prone to be confused with os.path.commonpath (which was 
introduced in Python 3.5).

I believe making this function raise a DeprecationWarning would help avoid 
having this kind of bugs.

--
components: Library (Lib)
messages: 292993
nosy: Valentin.Lorentz
priority: normal
severity: normal
status: open
title: Deprecate os.path.commonprefix

___
Python tracker 

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



[issue12857] Expose called function on frame object

2017-05-04 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



Re: Problems

2017-05-04 Thread justin walters
On Thu, May 4, 2017 at 4:42 AM, aohK euqsarraT 
wrote:

> I have been using pycharm + python 3.6 for a year and then i updated
> pycharm, that was when things became a super buggy mess. I tried to
> reinstall everything from scratch but the python installation keeps having
> the previous wrong paths that pycharm and python 3.6 are not connected, how
> do i make my computer forget all these things and reinstall with all things
> automatically work together like the very first time i installed it? (Just
> like my other laptop that i just have to click "next" and tick the
> recommended sections then everything is in its place). Thanks!
> --
> https://mail.python.org/mailman/listinfo/python-list
>

This is soemthing you should contact Pycharm Support about. There is
probably a configuration option
under preferences to point Pycharm at your Python executable. I usually set
this up
with a virtualenv for each project.

This link looks like it could be helpful:
https://www.jetbrains.com/help/pycharm/2017.1/configuring-python-interpreter-for-a-project.html

Also, when selecting an interpreter for a new project or changing the
interpreter for an existing project, you don't
have to choose from the dropdown. You can manually enter a path as well.

Hope this helps.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30263] regrtest: log the system load?

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

> why will a 1 CPU environment using -j8?

Many tests of the Python test suite spend a significant time on just sleeping 
and waiting for I/O. Using -jN with N > 1 runs tests much faster.

> isn't that too much for it?

That's a good question :-) At least, we now have one more tool to take a 
decision. Maybe the buildbot slave allows also more than one build in parallel? 
(ex: test 3.5 and 3.6 branches)

--

___
Python tracker 

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



[issue22610] test_ftplib fails with sem_init: Too many open files

2017-05-04 Thread STINNER Victor

STINNER Victor added the comment:

I didn't see this error recently on any buildbot.

While the patch seems safe, I prefer to not apply it to prevent any kind of 
regression.

--
nosy: +haypo
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue30185] forkserver process should silence KeyboardInterrupt

2017-05-04 Thread Antoine Pitrou

Changes by Antoine Pitrou :


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

___
Python tracker 

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



[issue30263] regrtest: log the system load?

2017-05-04 Thread Louie Lu

Louie Lu added the comment:

why will a 1 CPU environment using -j8?
isn't that too much for it?

--
nosy: +louielu

___
Python tracker 

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



  1   2   >