@@ -1900,6 +1900,30 @@ boolean access(PosixPath path, int mode, int dirFd, boolean effectiveIds, boolea
19001900 }
19011901 }
19021902
1903+ @ Builtin (name = "fchmod" , minNumOfPositionalArgs = 2 , parameterNames = {"fd" , "mode" })
1904+ @ ArgumentClinic (name = "fd" , conversion = ClinicConversion .Int )
1905+ @ ArgumentClinic (name = "mode" , conversion = ClinicConversion .Int )
1906+ @ GenerateNodeFactory
1907+ abstract static class FChmodNode extends PythonBinaryClinicBuiltinNode {
1908+ @ Override
1909+ protected ArgumentClinicProvider getArgumentClinic () {
1910+ return PosixModuleBuiltinsClinicProviders .FChmodNodeClinicProviderGen .INSTANCE ;
1911+ }
1912+
1913+ @ Specialization
1914+ PNone fchmod (VirtualFrame frame , int fd , int mode ,
1915+ @ Cached SysModuleBuiltins .AuditNode auditNode ,
1916+ @ CachedLibrary ("getPosixSupport()" ) PosixSupportLibrary posixLib ) {
1917+ auditNode .audit ("os.chmod" , fd , mode , -1 );
1918+ try {
1919+ posixLib .fchmod (getPosixSupport (), fd , mode );
1920+ } catch (PosixException e ) {
1921+ throw raiseOSErrorFromPosixException (frame , e , fd );
1922+ }
1923+ return PNone .NONE ;
1924+ }
1925+ }
1926+
19031927 @ Builtin (name = "chmod" , minNumOfPositionalArgs = 2 , parameterNames = {"path" , "mode" }, varArgsMarker = true , keywordOnlyNames = {"dir_fd" , "follow_symlinks" })
19041928 @ ArgumentClinic (name = "path" , conversionClass = PathConversionNode .class , args = {"false" , "true" })
19051929 @ ArgumentClinic (name = "mode" , conversion = ClinicConversion .Int )
0 commit comments