| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib64/python3.9/site-packages/awscrt/ |
Upload File : |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
from weakref import WeakSet
__all__ = [
'aio',
'auth',
'crypto',
'http',
'io',
'mqtt',
'mqtt5',
'mqtt_request_response',
's3',
'websocket',
]
__version__ = '0.31.1'
class NativeResource:
"""
Base for classes that bind to a native type.
_binding is a python capsule referencing the native object.
Note to developers: If NativeResource B depends on the existence of NativeResource A,
have B's native code Py_INCREF/DECREF A's python class. This ensures that A will not be destroyed before B.
If we simply had python class B referencing A, and the GC decided to clean up both, it might destroy A before B.
"""
# For tracking live NativeResources in tests/debug.
# Note that WeakSet can accurately report if 0 objects exist, but iteration isn't 100% thread-safe.
_track_lifetime = False
_living = WeakSet()
__slots__ = ('_binding', '__weakref__')
def __init__(self):
if NativeResource._track_lifetime:
NativeResource._living.add(self)