Skip to content

Commit afb5e25

Browse files
pi-anlandrewleech
authored andcommitted
weakref: Add basic stub function to aid in porting.
Signed-off-by: Andrew Leech <andrew@alelec.net>
1 parent 50ed36f commit afb5e25

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

python-stdlib/weakref/manifest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
metadata(version="0.0.1")
2+
3+
module("weakref.py")

python-stdlib/weakref/weakref.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
# weakref
3+
https://docs.python.org/3/library/weakref.html
4+
5+
Micropython does not have support for weakref in the VM, so currently this is a simple stub
6+
module that directly assigns the object reference to simplify porting of other libraries.
7+
"""
8+
9+
10+
def ref(obj):
11+
return lambda: obj

0 commit comments

Comments
 (0)