[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-14 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Dong-hee Na


Dong-hee Na  added the comment:

@sobolevn

Do you want to close it?
Cleaning up the issue is one of the duties of triage members :)

--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Dong-hee Na


Change by Dong-hee Na :


--
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Dong-hee Na


Dong-hee Na  added the comment:

@gvanrossum

Ah okay, Looks like bpo-46195 is the root of this issue.
In this case, backporting is reasonable.

--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Guido van Rossum

Guido van Rossum  added the comment:

Wasn’t the fix for it also backported?

(Weird that the test wasn’t part of the fix.)

--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Dong-hee Na


Dong-hee Na  added the comment:

When I take a look at previous PRs, most of adding test cases were not 
backported.
The backported cases were triggered by bug issues.
But let's pass this case as an exceptional case.

--
nosy: +corona10

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread miss-islington


miss-islington  added the comment:


New changeset d9101c4e49dc29f21319493818130ad5468402a2 by Miss Islington (bot) 
in branch '3.9':
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
https://github.com/python/cpython/commit/d9101c4e49dc29f21319493818130ad5468402a2


--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread miss-islington


miss-islington  added the comment:


New changeset a468866a67d83a24e3a3c3a0070129773d28bbd9 by Miss Islington (bot) 
in branch '3.10':
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
https://github.com/python/cpython/commit/a468866a67d83a24e3a3c3a0070129773d28bbd9


--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +28770
pull_request: https://github.com/python/cpython/pull/30567

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28771
pull_request: https://github.com/python/cpython/pull/30568

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 1de60155d5d01be2924e72fb68dd13d4fd00acd7 by Nikita Sobolev in 
branch 'main':
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
https://github.com/python/cpython/commit/1de60155d5d01be2924e72fb68dd13d4fd00acd7


--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Alex Waygood


Change by Alex Waygood :


--
components: +Tests -Library (Lib)
type:  -> behavior

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +gvanrossum, kj

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-11 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-11 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

I will send a PR today :)

--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-11 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Right now this corner case is not tested:

```python
class Some:
x: int = None

import typing
assert typing.get_type_hints(Some) == {'x': int}
```

Notice that we don't add implicit `Optional` type to `x`. This is different for 
function arguments that will have `Optional` added.

I think it is a good idea to add a test for this. Espeically given that we can 
change function's behavior.

Context:
- https://bugs.python.org/issue46195
- https://github.com/python/cpython/pull/30304

--
components: Library (Lib)
messages: 410307
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Add an explicit test for `get_type_hints` for a class field with `None` 
default
versions: Python 3.11

___
Python tracker 

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