File tree Expand file tree Collapse file tree 6 files changed +35
-10
lines changed Expand file tree Collapse file tree 6 files changed +35
-10
lines changed Original file line number Diff line number Diff line change 70
70
if : contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
71
71
run : |
72
72
pip install --upgrade build twine
73
- for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
74
- sed -i -e "s/0.0.0+auto.0/1.2.3/" $file;
75
- done;
73
+ find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/1.2.3/" {} +
76
74
python -m build
77
75
twine check dist/*
Original file line number Diff line number Diff line change 81
81
TWINE_USERNAME : ${{ secrets.pypi_username }}
82
82
TWINE_PASSWORD : ${{ secrets.pypi_password }}
83
83
run : |
84
- for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
85
- sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file;
86
- done;
84
+ find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
87
85
python -m build
88
86
twine upload dist/*
Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ def __next__(self):
69
69
self .exc .__traceback__ = None
70
70
raise self .exc
71
71
72
-
73
72
# Pause task execution for the given time (integer in milliseconds, uPy extension)
74
73
# Use a SingletonGenerator to do it without allocating on the heap
75
74
def sleep_ms (t , sgen = SingletonGenerator ()):
@@ -93,6 +92,34 @@ def sleep(t):
93
92
return sleep_ms (int (t * 1000 ))
94
93
95
94
95
+ ################################################################################
96
+ # "Never schedule" object"
97
+ # Don't re-schedule the object that awaits the _never singleton.
98
+ # For internal use only. Some constructs, like `await event.wait()`,
99
+ # work by NOT re-scheduling the task which calls wait(), but by
100
+ # having some other task schedule it later.
101
+ class _Never :
102
+ def __init__ (self ):
103
+ self .state = None
104
+ self .exc = StopIteration ()
105
+
106
+ def __iter__ (self ):
107
+ return self
108
+
109
+ def __await__ (self ):
110
+ return self
111
+
112
+ def __next__ (self ):
113
+ if self .state is not None :
114
+ self .state = None
115
+ return None
116
+ else :
117
+ self .exc .__traceback__ = None
118
+ raise self .exc
119
+
120
+ _never = _Never ()
121
+
122
+
96
123
################################################################################
97
124
# Queue and poller for stream IO
98
125
Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ async def wait(self):
62
62
self .waiting .push_head (core .cur_task )
63
63
# Set calling task's data to the event's queue so it can be removed if needed
64
64
core .cur_task .data = self .waiting
65
- await core .sleep (0 )
65
+ core ._never .state = False
66
+ await core ._never
66
67
return True
67
68
68
69
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ async def gather(*aws, return_exceptions=False):
106
106
# # cancel all waiting tasks
107
107
# raise er
108
108
ts [i ] = await ts [i ]
109
- except Exception as er :
109
+ except ( core . CancelledError , Exception ) as er :
110
110
if return_exceptions :
111
111
ts [i ] = er
112
112
else :
Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ async def acquire(self):
69
69
# Set calling task's data to the lock's queue so it can be removed if needed
70
70
core .cur_task .data = self .waiting
71
71
try :
72
- await core .sleep (0 )
72
+ core ._never .state = False
73
+ await core ._never
73
74
except core .CancelledError as er :
74
75
if self .state == core .cur_task :
75
76
# Cancelled while pending on resume, schedule next waiting Task
You can’t perform that action at this time.
0 commit comments