Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No context manager for socket #195

Closed
anecdata opened this issue Mar 15, 2024 · 1 comment · Fixed by #196
Closed

No context manager for socket #195

anecdata opened this issue Mar 15, 2024 · 1 comment · Fixed by #196

Comments

@anecdata
Copy link
Member

anecdata commented Mar 15, 2024

Lack of with context manager makes it harder to write code / use libraries, compatible across radios (sources of sockets; e.g., native wifi, WIZnet, ESP32SPI).

Example:
adafruit/Adafruit_CircuitPython_NTP#31

Traceback (most recent call last):
  File "<stdin>", line 38, in <module>
  File "adafruit_ntp.py", line 77, in datetime
AttributeError: 'socket' object has no attribute '__exit__'
@dhalbert
Copy link
Contributor

If you feel so inclined, a PR would be welcome.

@anecdata anecdata linked a pull request Mar 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants