Skip to content

Commit

Permalink
Managed functions without __name__
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Simionato committed Feb 24, 2025
1 parent bbc430b commit cdeab3c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ HISTORY

## Unreleased

## 5.2.1 (2025-02-24)

Shiv Krishna Jaiswal suggested how to manage che case of functions
without __name__.
Michał Górny contributed a fix for the generation of the source package.

## 5.2.0 (2025-02-22)

Changed the build procedure to use pyproject.toml and moved the tests
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.rst LICENSE.txt CHANGES.md performance.sh documentation.pdf
include README.rst LICENSE.txt CHANGES.md performance.sh
include src/decorator.py
include tests/*.py
graft docs
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ md: tests/documentation.py

upload: README.rst
rm -rf build/* dist/* && python -m build && twine upload --verbose dist/*

tag:
git tag 5.2.1; git push origin tag 5.2.1
2 changes: 1 addition & 1 deletion docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
|Author | Michele Simionato|
|---|---|
|E-mail | michele.simionato@gmail.com|
|Version| 5.2.0 (2025-02-22)|
|Version| 5.2.0 (2025-02-24)|
|Supports| Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12|
|Download page| https://pypi.org/project/decorator/5.2.0|
|Installation| ``pip install decorator``|
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

6 changes: 5 additions & 1 deletion src/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from contextlib import _GeneratorContextManager
from inspect import getfullargspec, iscoroutinefunction, isgeneratorfunction

__version__ = '5.2.0'
__version__ = '5.2.1'

DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')
POS = inspect.Parameter.POSITIONAL_OR_KEYWORD
Expand Down Expand Up @@ -256,6 +256,10 @@ def fun(*args, **kw):
fun.__module__ = func.__module__
except AttributeError:
pass
try:
fun.__name__ = func.__name__
except AttributeError: # happens with old versions of numpy.vectorize
func.__name__ == 'noname'
try:
fun.__dict__.update(func.__dict__)
except AttributeError:
Expand Down
Empty file removed tests/__init__.py
Empty file.

0 comments on commit cdeab3c

Please sign in to comment.