[issue43869] Fix documentation of epoch/time.time

2021-04-16 Thread Ofek Lev


New submission from Ofek Lev :

The descriptions for the following:

- https://docs.python.org/3/library/time.html#epoch
- https://docs.python.org/3/library/time.html#time.time

indicate that it is platform dependent. However, that is likely untrue. See the 
brief discussion here: 
https://github.com/DataDog/integrations-core/pull/6692#discussion_r427469097

--
assignee: docs@python
components: Documentation
messages: 391214
nosy: Ofekmeister, docs@python, p-ganssle
priority: normal
severity: normal
status: open
title: Fix documentation of epoch/time.time
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue18617] AIA chasing for missing intermediate certificates on TLS connections

2021-02-02 Thread Ofek Lev


Ofek Lev  added the comment:

Any update on this?

--
nosy: +Ofekmeister

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



[issue42965] Optional callable raises TypeError

2021-01-19 Thread Ofek Lev


Ofek Lev  added the comment:

Ah I see, thanks!

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

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



[issue42965] Optional callable raises TypeError

2021-01-19 Thread Ofek Lev


Ofek Lev  added the comment:

I'm using the deprecated typing.Callable instead now and that works

--

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



[issue42965] Optional callable raises TypeError

2021-01-19 Thread Ofek Lev


New submission from Ofek Lev :

https://docs.python.org/3.9/library/typing.html#callable

```
Python 3.9.1 (default, Jan 12 2021, 16:45:25)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Optional
>>> from collections.abc import Callable
>>>
>>> Hasher = Optional[Callable[[bytes], bytes]]
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.9/typing.py", line 262, in inner
return func(*args, **kwds)
  File "/usr/local/lib/python3.9/typing.py", line 339, in __getitem__
return self._getitem(self, parameters)
  File "/usr/local/lib/python3.9/typing.py", line 463, in Optional
return Union[arg, type(None)]
  File "/usr/local/lib/python3.9/typing.py", line 262, in inner
return func(*args, **kwds)
  File "/usr/local/lib/python3.9/typing.py", line 339, in __getitem__
return self._getitem(self, parameters)
  File "/usr/local/lib/python3.9/typing.py", line 451, in Union
parameters = _remove_dups_flatten(parameters)
  File "/usr/local/lib/python3.9/typing.py", line 231, in _remove_dups_flatten
return tuple(_deduplicate(params))
  File "/usr/local/lib/python3.9/typing.py", line 205, in _deduplicate
all_params = set(params)
TypeError: unhashable type: 'list'
>>>
>>> from typing import Tuple
>>> Hasher = Optional[Callable[Tuple[bytes], bytes]]
>>>
```

Tuple type for arguments makes it work

--
components: Library (Lib)
messages: 385246
nosy: Ofekmeister
priority: normal
severity: normal
status: open
title: Optional callable raises TypeError
type: behavior
versions: Python 3.9

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2020-04-04 Thread Ofek Lev


Ofek Lev  added the comment:

> For convenience, a handler that retries unlink() and rmdir() could be 
> distributed with shutil. For ease of use, it could be enabled by default on 
> Windows.

Any update on that? I just spent a bunch of time debugging this on Windows.

--
nosy: +Ofekmeister

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



[issue36258] Incorrect docstring of the ssl module

2019-03-10 Thread Ofek Lev


New submission from Ofek Lev :

The docstring refers to the function `fetch_server_certificate` that no longer 
exists. Context from 
https://github.com/python/cpython/pull/12168#issuecomment-469488585:

"""
In the commit on 8/28/2007, the ssl.py module was first added and it contained 
the fetch_server_certificate() function. That function was removed with commit 
r57680 on 8/30/2007. The function get_server_certificate() was added in commit 
r58164 on 9/18/2007.
...
Additionally, there are more than just 2 functions now, so it seems to me that 
the entire module docstring should be reviewed and updated to reflect the 
current state of the module or else it should be removed since it hasn't been 
kept in sync.
"""

--
assignee: docs@python
components: Documentation
messages: 337639
nosy: Ofekmeister, cheryl.sabella, docs@python
priority: normal
severity: normal
status: open
title: Incorrect docstring of the ssl module
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

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



[issue33245] Unable to send CTRL_BREAK_EVENT

2018-04-08 Thread Ofek Lev

New submission from Ofek Lev <ofekmeis...@gmail.com>:

Vault (https://github.com/hashicorp/vault) requires the use of signals to 
trigger certain output 
https://www.vaultproject.io/docs/internals/telemetry.html.

The required signal isn't sent on py2.7:

>>> import os
>>> import signal
>>> import psutil
>>> p = psutil.Process([p.info for p in psutil.process_iter(attrs=['pid', 
>>> 'name']) if 'vault' in p.info['name']][0]['pid'])
>>> p.exe()
'C:\\Users\\Ofek\\Desktop\\vault.exe'
>>> p.pid
15536
>>> os.kill(p.pid, signal.CTRL_BREAK_EVENT)
Traceback (most recent call last):
  File "", line 1, in 
WindowsError: [Error 87] The parameter is incorrect

Interestingly, on py3.6 that code works but instead produces this:

OSError: [WinError 87] The parameter is incorrect

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 1, in 
SystemError:  returned a result with an error set

--
components: Windows
messages: 315108
nosy: Ofekmeister, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Unable to send CTRL_BREAK_EVENT
type: behavior
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33245>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20849] add exist_ok to shutil.copytree

2017-08-01 Thread Ofek Lev

Changes by Ofek Lev <ofekmeis...@gmail.com>:


--
pull_requests: +3020

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20849>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Ofek Lev

Ofek Lev added the comment:

Fixed with shell=True

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30783>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Ofek Lev

New submission from Ofek Lev:

The following example shows that we are indeed changing PATH, but the 
subprocess does not acknowledge it in Windows 7 x64. Also note this works in 
Linux (Ubuntu 16.04).

-

import os
import subprocess
from contextlib import contextmanager
from tempfile import TemporaryDirectory


def get_python_path():
return subprocess.check_output(
['python', '-c', 'import sys;print(sys.executable)']
).decode().strip()


@contextmanager
def temp_chdir(cwd=None):
with TemporaryDirectory() as d:
origin = cwd or os.getcwd()
os.chdir(d)

try:
yield d
finally:
os.chdir(origin)


def create_venv(d, pypath=None):
command = ['virtualenv', d]
if pypath:
command.extend(['-p', pypath])
subprocess.call(command)


@contextmanager
def venv(d):
if os.path.exists(os.path.join(d, 'bin')):  # no cov
venv_exe_dir = os.path.join(d, 'bin')
elif os.path.exists(os.path.join(d, 'Scripts')):
venv_exe_dir = os.path.join(d, 'Scripts')
else:
raise OSError('Unable to locate executables directory.')

old_path = os.environ['PATH']
os.environ['PATH'] = '{}{}{}'.format(venv_exe_dir, os.pathsep, old_path)
yield
os.environ['PATH'] = old_path


def test_venv():
with temp_chdir() as d:
d = os.path.join(d, 'test_env')
create_venv(d)
global_python = get_python_path()
print('PATH', os.environ['PATH'][:140])

with venv(d):
print('PATH', os.environ['PATH'][:140])
venv_python = get_python_path()

assert global_python != venv_python
assert global_python == get_python_path()

--
components: Windows
messages: 296986
nosy: Ofekmeister, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Spawned subprocesses don't respect environment
type: behavior
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30783>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28553] int.to_bytes docs logic error

2016-10-28 Thread Ofek Lev

New submission from Ofek Lev:

https://docs.python.org/3/library/stdtypes.html#int.to_bytes

To convert an int to the exact number of bytes required, the docs recommend 
"x.to_bytes((x.bit_length() // 8) + 1, ...)". This is incorrect when length is 
a multiple of 8, e.g. 296.

The correct way is "x.to_bytes((x.bit_length() + 7) // 8, ...)".

--
assignee: docs@python
components: Documentation
messages: 279641
nosy: Ofekmeister, docs@python
priority: normal
severity: normal
status: open
title: int.to_bytes docs logic error
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28553>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8800] add threading.RWLock

2016-09-07 Thread Ofek Lev

Ofek Lev added the comment:

What is the status of the patch?

--
nosy: +Ofekmeister

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8800>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com