Skip to content

Commit

Permalink
Fix error on warn with category on Truffleruby
Browse files Browse the repository at this point in the history
Avoid error "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1

The error was triggered by adding the :deprecation category in ged#528
  • Loading branch information
larskanis committed Apr 27, 2023
1 parent d1f5aaa commit 9ded3b9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/pg.rb
Expand Up @@ -115,4 +115,15 @@ module TextEncoder
require 'pg/tuple'
autoload :VERSION, 'pg/version'


# Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1
if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations)
module TruffleFixWarn
def warn(str, category=nil)
super(str)
end
end
Warning.extend(TruffleFixWarn)
end

end # module PG

0 comments on commit 9ded3b9

Please sign in to comment.