this repo has no description
at trunk 59 lines 1.8 kB view raw
1/* Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) */ 2#pragma once 3 4#include <cstdarg> 5 6#include "globals.h" 7#include "handles-decl.h" 8#include "thread.h" 9 10namespace py { 11 12enum class SysFlag { 13 kDebug, 14 kInspect, 15 kInteractive, 16 kOptimize, 17 kDontWriteBytecode, 18 kNoUserSite, 19 kNoSite, 20 kIgnoreEnvironment, 21 kVerbose, 22 kBytesWarning, 23 kQuiet, 24 kHashRandomization, 25 kIsolated, 26 kDevMode, 27 kUTF8Mode, 28 kNumFlags, 29}; 30 31// Helper function to flush stdout and stderr 32int flushStdFiles(); 33 34void initializeRuntimePaths(Thread* thread); 35 36// Initializes sys module with data that can vary between startups. This must 37// be called after the runtime constructor and before Runtime::initialize(). 38RawObject initializeSys(Thread* thread, const Str& executable, 39 const List& python_path, const Tuple& flags_data, 40 const List& warnoptions, 41 bool extend_python_path_with_stdlib); 42 43void setPycachePrefix(Thread* thread, const Object& pycache_prefix); 44 45// Internal equivalents to PySys_Write(Stdout|Stderr): Write a formatted string 46// to sys.stdout or sys.stderr, or stdout or stderr if writing to the Python 47// streams fails. No more than 1000 characters will be written; if the output is 48// truncated, it will be followed by "... truncated". 49// 50// May be called with a pending exception, which will be saved and restored; any 51// exceptions raised while writing to the stream are ignored. 52void writeStdout(Thread* thread, const char* format, ...) 53 FORMAT_ATTRIBUTE(2, 3); 54void writeStdoutV(Thread* thread, const char* format, va_list va); 55void writeStderr(Thread* thread, const char* format, ...) 56 FORMAT_ATTRIBUTE(2, 3); 57void writeStderrV(Thread* thread, const char* format, va_list va); 58 59} // namespace py