[issue46500] make timeit module accept files

2022-01-24 Thread Arjun


Arjun  added the comment:

I was modifying the try/except/finally/else code generation and wanted to run 
my own benchmarks.

It's cumbersome to edit them in a command to test different variations, 
especially when you have to indent.

--

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



[issue46500] make timeit module accept files

2022-01-23 Thread Arjun


Change by Arjun :


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

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



[issue46500] make timeit module accept files

2022-01-23 Thread Arjun


New submission from Arjun :

currently, timeit accepts programs line by line as commandline arguments. 

it would be convenient to give it a program as a file to benchmark.

--
components: Library (Lib)
messages: 411448
nosy: CCLDArjun
priority: normal
severity: normal
status: open
title: make timeit module accept files
type: enhancement

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



[issue44674] dataclasses should allow frozendict default value

2021-07-23 Thread Arjun


Arjun  added the comment:

Which frozendict does your message concern? I found this in some test: 
https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/test/test_builtin.py#L741
 or are you suggesting any user defined immutable object?

I'm not sure indicating that an object should be immutable to dataclasses will 
be less cumbersome than default_factory.

Currently, you have to do this:
> x: frozendict = field(default_factory=frozendict)

But, indicating mutability would be something like this:
> x: frozendict = field(mutable=false)

--
nosy: +CCLDArjun

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



[issue32536] ast and tokenize disagree about line number

2021-06-18 Thread Arjun


Arjun  added the comment:

Well actually, it depends on the platform?

--

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



[issue32536] ast and tokenize disagree about line number

2021-06-18 Thread Arjun


Arjun  added the comment:

the line numbers are different for me too (MacOS).

it seems that tokenize module is off by +1 line

--
nosy: +CCLDArjun

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



[issue44405] add program passed as string to dis module.

2021-06-13 Thread Arjun


Change by Arjun :


--
pull_requests: +25302
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26714

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



[issue44405] add program passed as string to dis module.

2021-06-12 Thread Arjun


Arjun  added the comment:

> If _test were considered obsolete, it could be removed.

removing _test: 
https://github.com/CCLDArjun/cpython/commit/8b3b8ccef0ef693f8f4105fd1eb56e9386675301
 does not break dis tests.

--

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



[issue44405] add program passed as string to dis module.

2021-06-12 Thread Arjun


Arjun  added the comment:

> If _test were considered obsolete, it could be removed.

Yup, originally it was added 2 decades ago (in 2000) originally as a test: 
1fdae12c932

--

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



[issue44405] add program passed as string to dis module.

2021-06-12 Thread Arjun


Arjun  added the comment:

Huh, that's actually weird that the "exisisting command line interface" (quotes 
because it was added as a test) isn't official. I've found it to be convinient 
as a newcomer to the cpython codebase. 

> What is unusual, I think, for a CLI test function is that it requires a 
> passed in argument

git blame shows the commit hash is 095668914c3, which is for bpo: 
https://bugs.python.org/issue18538 "python -m dis now uses argparse". The 
Misc/HISTORY file references the change in section "What's New in Python 3.4.0 
Alpha 3?"

Regardless of the cli being official, personally I think, it's a good feature 
to add. But also, maybe I should start a discussion in python-ideas about 
making it official?

--

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



[issue44405] add program passed as string to dis module.

2021-06-12 Thread Arjun


New submission from Arjun :

python dis module should have a program passed in as string.

Currently, you can do this:
$ echo "x = 6" | python -m dis /dev/stdin
  1   0 LOAD_CONST   0 (6)
  2 STORE_NAME   0 (x)
  4 LOAD_CONST   1 (None)
  6 RETURN_VALUE

would be convenient like this:
$ ./python.exe -m dis -c "x=6"
  1   0 LOAD_CONST   0 (6)
  2 STORE_NAME   0 (x)
  4 LOAD_CONST   1 (None)
  6 RETURN_VALUE

these changes seem to be working.

--
components: Library (Lib)
files: dis.patch
keywords: patch
messages: 395720
nosy: CCLDArjun
priority: normal
severity: normal
status: open
title: add program passed as string to dis module.
type: enhancement
Added file: https://bugs.python.org/file50107/dis.patch

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



[issue14322] More test coverage for hmac

2021-06-10 Thread Arjun


Arjun  added the comment:

would the update invalid test belong in the TestVectorsTestCase class or should 
I make a new one?

--

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



[issue14322] More test coverage for hmac

2021-06-09 Thread Arjun


Change by Arjun :


--
pull_requests: +25222
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26636

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



[issue14322] More test coverage for hmac

2021-06-09 Thread Arjun


Arjun  added the comment:

The only things I think we should add to the current hmac tests are 
test_update_error_handling and test_with_invalid_msg. 

For test_withnoncallable_digestmod(), hmac itself seems it can no longer be 
used:

>>> hmac.HMAC(b"", None, "hmac")

using new
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/arjun/Python/Sources/cpython/Lib/hmac.py", line 61, in __init__
self._init_hmac(key, msg, digestmod)
  File "/Users/arjun/Python/Sources/cpython/Lib/hmac.py", line 69, in _init_hmac
self._hmac = _hashopenssl.hmac_new(key, msg, digestmod=digestmod)
ValueError: unsupported hash type hmac

For tests test_small_block_size and test_no_block_size, a custom .blocksize 
cannot be set (changing .block_size has no difference on digest()):

>>> hmac.HMAC(b"", None, "md5").blocksize = 15

using new
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'HMAC' object attribute 'blocksize' is read-only

```
class myHMAC(hmac.HMAC):
blocksize = 1
def __init__(self, key, msg, digestmod_):
super().__init__(key, msg, digestmod=digestmod_)

h = myHMAC(b"key", b"", digestmod_="md5")
h.digest() # <- works perfectly fine.
```
Does this sound okay? I can go ahead an implement it if so.

--
nosy: +CCLDArjun -Vijay.Majagaonkar, christian.heimes, eric.araujo, 
gregory.p.smith, packetslave, pitrou

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



[issue44324] add a "expected expression" syntax error

2021-06-07 Thread Arjun


Change by Arjun :


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

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



[issue44324] add a "expected expression" syntax error

2021-06-06 Thread Arjun


Arjun  added the comment:

> This one will be very tricky to do correctly because the '=' is very 
> context-sensitive and the parser can be confused when backtracking, so this 
> *may* be quite delicate/complex

Well, I was thinking we could just do a simple check in 
_PyPegen_check_tokenizer_errors or _PyPegen_run_parser functions. If the last 
three tokens in the Parser object's tokens array are NAME, EQUAL/MINEQUAL/etc 
and NEWLINE, we raise the special error. Is this the right way to do it? I saw 
that unclosed parentheses' special error are checked in the same place. 

> I suspect this is going to be a pain for malformed expressions on the right

Yea, I realized that the "expected an expression" error can be used in multiple 
places. Could be added one by one?

--

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



[issue44324] add a "expected expression" syntax error

2021-06-06 Thread Arjun


Arjun  added the comment:

I forgot to add, I would be willing to make the necessary changes, if accepted

--

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



[issue44324] add a "expected expression" syntax error

2021-06-06 Thread Arjun


New submission from Arjun :

Recently, CPython got a new syntax error, "SyntaxError: expression expected 
after dictionary key and ':'". I propose to add a "expected expression" in 
general for consistency. I would like to have it changed for all the "equals" 
(e.g. PLUSEQUAL, MINEQUAL, etc). 


>>> x =
  File "", line 1
x =
^
SyntaxError: invalid syntax

Would be enhanced by:

>>> x +=
  File "", line 1
x =
 ^
SyntaxError: expected expression

--
components: Parser
messages: 395213
nosy: CCLDArjun, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: add a "expected expression" syntax error
type: enhancement
versions: Python 3.11

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



[issue34420] Complete your registration to Python tracker -- keysnSwaZe6PtikiEZf4bdIXIiuwFyFZFxp

2018-08-17 Thread sai arjun


New submission from sai arjun :

I have received the email.

Sent from Mail for Windows 10

From: Python tracker
Sent: 16 August 2018 17:08
To: venkkar...@yahoo.com
Subject: Complete your registration to Python tracker -- 
keysnSwaZe6PtikiEZf4bdIXIiuwFyFZFxp

To complete your registration of the user "arjun" with
Python tracker, please do one of the following:

- send a reply to rep...@bugs.python.org and maintain the subject line as is 
(the
reply's additional "Re:" is ok),

- or visit the following URL:

https://bugs.python.org/?@action=confrego&otk=snSwaZe6PtikiEZf4bdIXIiuwFyFZFxp

--
messages: 323657
nosy: arjun
priority: normal
severity: normal
status: open
title: Complete your registration to Python tracker -- 
keysnSwaZe6PtikiEZf4bdIXIiuwFyFZFxp

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



[issue33218] Fix instances in documentation where dictionaries are referenced as unordered

2018-04-03 Thread arjun v

New submission from arjun v :

In python 3.6 (and above hopefully), dictionary keys are going to be ordered, 
while their documentation still reference them as being unordered.

https://docs.python.org/3/tutorial/datastructures.html#dictionaries 

1: `It is best to think of a dictionary as an unordered set of key: value 
pairs,...`

2: `Performing list(d.keys()) on a dictionary returns a list of all the keys 
used in the dictionary, in arbitrary order..`

The examples should also be changed to reflect the same:
```
>>> tel = {'jack': 4098, 'sape': 4139}
>>> tel['guido'] = 4127
>>> tel
{'sape': 4139, 'guido': 4127, 'jack': 4098}
>>> tel['jack']
4098
>>> del tel['sape']
>>> tel['irv'] = 4127
>>> tel
{'guido': 4127, 'irv': 4127, 'jack': 4098}
>>> list(tel.keys())
['irv', 'guido', 'jack']
>>> sorted(tel.keys())
['guido', 'irv', 'jack']
>>> 'guido' in tel
True
>>> 'jack' not in tel
False
```

```
>>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])
{'sape': 4139, 'guido': 4127, 'jack': 4098}
```

```
>>> dict(sape=4139, guido=4127, jack=4098)
{'sape': 4139, 'guido': 4127, 'jack': 4098}
```

--
assignee: docs@python
components: Documentation
messages: 314892
nosy: arjunv, docs@python
priority: normal
severity: normal
status: open
title: Fix instances in documentation where dictionaries are referenced as 
unordered
versions: Python 3.6, Python 3.7, Python 3.8

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