MCPcopy Index your code
hub / github.com/python/cpython / check_enableusersite

Function check_enableusersite

Lib/site.py:258–280  ·  view source on GitHub ↗

Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe and enabled

()

Source from the content-addressed store, hash-verified

256
257
258def check_enableusersite():
259 """Check if user site directory is safe for inclusion
260
261 The function tests for the command line flag (including environment var),
262 process uid/gid equal to effective uid/gid.
263
264 None: Disabled for security reasons
265 False: Disabled by user (command line option)
266 True: Safe and enabled
267 """
268 if sys.flags.no_user_site:
269 return False
270
271 if hasattr(os, "getuid") and hasattr(os, "geteuid"):
272 # check process uid == effective uid
273 if os.geteuid() != os.getuid():
274 return None
275 if hasattr(os, "getgid") and hasattr(os, "getegid"):
276 # check process gid == effective gid
277 if os.getegid() != os.getgid():
278 return None
279
280 return True
281
282
283# NOTE: sysconfig and it's dependencies are relatively large but site module

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…